The problem with Nullable: nullable(null).isNull is false.
jfondren
julian.fondren at gmail.com
Tue Jul 26 15:21:36 UTC 2022
On Monday, 25 July 2022 at 13:05:08 UTC, Steven Schveighoffer
wrote:
>
> The real "problem" is that Nullable is called "Nullable".
>
History of this poor type:
1. it's a way to add a Null state to a value type. You know, like
Java. Very convenient type for trivial task.
2. hey! This doesn't act like an optional type/maybe monad! This
is BROKEN. (convenience was deliberately broken to make it worse
for the original task.)
3. hey! This acts like an optional type/maybe monad that doesn't
care if the wrapped type also has something like a null state!
This is BROKEN. (now proposed: deliberately break it to make it
worse as an optional type.)
What it needed was not code but a clear justification and context
in the documentation, without assuming that people would just get
it from the feature list.
More information about the Digitalmars-d
mailing list