3 ms·
Isn't Object itself (and any class) already an optional at the language level? Either it's null, so has no value, or it's not null so has a value, and you can
by Aardwolf 4y ago
Isn't Object itself (and any class) already an optional at the language level?
Either it's null, so has no value, or it's not null so has a value, and you can check for null-ness. What more is needed?
Seems like the opposite, a guaranteed non-null value at core language level, would be novel instead...
- usrusr 4y agoRight, if only there was a language on the JVM that did that /s It's really an eye-opener when you compare kotlin and scala, with all their superficial similarities: Where kotlin simply takes the @Nonnull annotation, promotes it to a core language feature and drowns it in convenient function-scope syntactic sugar until it's actually nice to use, scala opts for Option and stacks layer upon layer of architecture trying to make Option somehow disappear. I lost half a decade holding on to plain java snobbishly dismissing kotlin as a second class scala before I finally got converted.