4 ms·
> Option can still be NULL ("None" in rust), wrapping NULL in a struct doesn't provide any safety. The safety of Option wrapper types is from the other language
by vmchale 8y ago
> Option can still be NULL ("None" in rust), wrapping NULL in a struct doesn't provide any safety. The safety of Option wrapper types is from the other language features (like rust's "match")
The advantage here (especially true in Haskell) is that you can use monadic error handling to make this far more pleasant.
- masklinn 8y agoThat's a secondary nicety (alongside the ability to make everything "nullable" not just the references/pointers subset), the primary advantage is that: 1. it clearly separates "nullable" and "non-nullable" providing better modelling tools 2. the compiler assists/mandates null-checking, providing better type-safety