(non)nullable types

Sergey Gromov snake.scaly at gmail.com
Mon Feb 16 19:03:45 PST 2009


Mon, 16 Feb 2009 13:26:29 +1100, Daniel Keep wrote:

> To clarify: I am, and always have been, in full support of non-nullable
> types, preferably by default.  What I object to specifically in this
> case is the requirement to always check that a nullable value is not
> null every time it is used.

Hmm, I think I've got your point.  The nullable types should work
exactly as they work now, with the same consequences.  You don't need to
check for null to dereference, and you crash if you dereference null.
The non-nullable types are a separate territory.  Again, you don't need
to check for null to dereference, and you never crash because there is
never null.  You need an explicit run-time check to move from null to
non-null territory, but that's all you need, and only when you really
want it.

I think it's my favorite design so far.



More information about the Digitalmars-d mailing list