by rtpg · 11y ago · 0 comments
The Null pointer analysis is great, hope this stuff pollinates some of the more mainstream languages
Maybe your answer is "with Optional" (or Option, or Maybe). We just choose to use union types and have "Nil | T" (Nil or T) be the same as "Option(T)" in other languages.
Maybe you are thinking of Java/C#, where reference types can also be null, but this is not true in Crystal. It's also in a way similar (but not quite) to Swift, where optional types are different than types that can't be null.
Sum types supported in the language such as in Ceylon is another one.
And yet another one is safe dereferencing operators (?.) such as in Kotlin.
With something that leaves "Nullpointer analysis" obsolete/useless.