2 ms·
You're basically talking about using an untagged union as an optional type instead of a tagged union. Last I checked, Dotty will have union types [1], so we may
by acjohnson55 11y ago
You're basically talking about using an untagged union as an optional type instead of a tagged union. Last I checked, Dotty will have union types [1], so we may well see that become a more common way to express optionality. Or not. Either way, that's a pretty small distinction.
I haven't programmed Kotlin before, so I'm not sure what their answer to implicits is. For ad hoc polymorphism, none of the alternatives is particularly pretty. Perhaps the current answer is to resort to adapter classes, which would be the way to do it in Java.
[1] https://d-d.me/talks/scalaworld2015/#/6 https://d-d.me/talks/scalaworld2015/#/6