Option type will have runtime overhead, while nullable types won’t, because
Option time is an enum (consuming memory).
Why not just mark optional references as optional, then the compiler can follow code execution and find whenever it can’t more be
Edit: I see I was misunderstood. I understand and agree with the advantages of avoiding null pointers. I’m not talking about arbitrary pointers that accept
null. I’m only asking why not use compile-time metadata, like C# 8’s nullable reference types and TypeScript with strict null checks, where default pointers can’t be null and there’s a special syntax (mostly
?) to indicate a pointer that can accept null.
Some is strange, in my opinion. Implicit conversion would be better. But that a language feature and not relevant.
Go to Source
Author: Chayim Friedman