3 ms·
I feel like that's just a weaker attempt at something like Maybe (Haskell) or Option (Rust).
by lkschubert8 8y ago
I feel like that's just a weaker attempt at something like Maybe (Haskell) or Option (Rust).
- elizarov 8y agoIt is not much weaker, but more pragmatic. A typical application has this need to represent a "missing" value quite often and adding a special `?`-based syntax for it totally pays of in practice. However, it is important to not that `String?` in Kotlin is not a syntactic sugar for `Option<String>`, but a syntactic sugar for `String|null`. The difference between the two might seem minor, but is quite big pragmatically, especially when combined with flow-sensitive typing.