Current sentiment on Nullable.get

FeepingCreature feepingcreature at gmail.com
Mon Dec 10 10:01:45 UTC 2018


Having recently been reminded that `alias Nullable.get this` 
exists, I'm considering a pull request to deprecate it. What's 
the sentiment on `alias Nullable.get this` in the community? My 
unchanged stance is that it's a blight and an interminable source 
of impossible to find runtime bugs, and an anti-feature that 
misses the point of Nullable to provide safe optional types.

The typical problem goes like this:

1. A dependency switches from T to Nullable!T.
2. You update your dependencies.
3. Your program still compiles (because Nullable!T silently casts 
to "T or exception") and you notice nothing.
4. Sometime later, your program crashes in production.

Thoughts?


More information about the Digitalmars-d mailing list