Current sentiment on Nullable.get
Rubn
where at is.this
Fri Dec 14 22:23:57 UTC 2018
On Thursday, 13 December 2018 at 13:47:34 UTC, Jonathan M Davis
wrote:
> The behavior is completely obvious if you understand that
> whether a Nullable is null refers to the Nullable itself and
> not the value that it contains. Looking at the documentation,
> it does need to be improved so that that is clearer. But if you
> understand that, then there is no confusion.
Isn't the behavior of everything obvious if you know how it
works? The reasons things should be named the way they are is to
help identify what they do. What you are describing is more
easily understood as a class named "Optional".
You mention that the template didn't work with types that were
already nullable. I want to know what the individual was thinking
when they expanded the functionality to include nullable types.
They could have easily added extra code that does an additional
check to see if the types are null. That's the logical thing to
do for a class named "Nullable". The way it is currently
implemented is the logical way to implement "Optional". You
wouldn't store a float point number in a type called int, would
you ?
More information about the Digitalmars-d
mailing list