3 ms·
The sugar your parent proposed would still be nice and has precedent in other languages with option types. Swift has something very similar[0], and Rust is deba
by sanderjd 12y ago
The sugar your parent proposed would still be nice and has precedent in other languages with option types. Swift has something very similar[0], and Rust is debating it[1]. Haskell's do-notation and Scala's for-comprehension are other solutions to the same general problem of conveniently using option types.
It may be a good thing to only support that sort of convenience for option types and not for nulls, in order to further encourage their use. Although using nullable types is already pretty darn convenient!
[0]: https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/OptionalChaining.html https://developer.apple.com/library/prerelease/ios/documenta...
[1]: https://github.com/rust-lang/rfcs/pull/204 https://github.com/rust-lang/rfcs/pull/204