Current sentiment on Nullable.get

Jacob Carlborg doob at me.com
Mon Dec 10 19:02:57 UTC 2018


On 2018-12-10 16:47, aliak wrote:

> Sounds like a step forward, deprecating that.
>
> Do people consider Nullable a type of Optional thing in general?

No, it's not the same as Optional.

> I have  a written a bit more details here [0] but basically I don't think
> deprecating .get is enough to make it "safe" - granted - depending on
> what safe means. In the context of D a segfault is safe so maybe that's
> ok. But then deprecating get doesn't add safety in that context anyway.

"get" has a few use cases, i.e. when you need to explicitly check if the 
value is present or not. Then, if it is present, you can use "get" to 
minimize overhead. But it's rare to need it.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list