Current sentiment on Nullable.get

John Chapman johnch_atms at
Mon Dec 10 17:37:44 UTC 2018

On Monday, 10 December 2018 at 10:01:45 UTC, FeepingCreature 
> 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?

I would deprecate "alias get this", rename the version of "get" 
that takes a fallback to "orDefault" and add "alias orDefault 

Going further, I'd also deprecate the weird "nullify" and 
"isNull", and instead add overloads of opAssign and opEquals for 

More information about the Digitalmars-d mailing list