Re:Kotlin: The Problem with null
by anaphylactic on Friday January 12, 2018 @05:17PM
(#16136831)
Optionals are sum types, too! No special-casing there. It's just that Crystal just has anonymous sum types, I guess, which can be a lot nicer to look at.
[ Parent
| on HN ]
Optional is a special case of a sum type where one of the types is Null.
If you have Null as a type whose only value is null, then an Optional is just a T|Null. No need for Optional to exist.