(non)nullable types

Don nospam at nospam.com
Mon Feb 16 01:26:25 PST 2009


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.
> 
> We have hardware null-dereference exceptions for this.
> 
> Another issue is that this subthread is talking about increasingly more
> complicated analysis by the compiler to try and determine if a given
> nullable value has been checked yet or not.  I don't think this is the
> job of the compiler; if I have a nullable value, it's because I wanted a
> nullable value, and I should be ready to deal with it appropriately.
> 
> Finally, this also creates a distinction between nullable types and
> everything else in the type system.

I am in complete agreement with you on all these points. Nullable types 
(int? *) and making non-nullable the default would add huge benefits; 
but I think others are proposing significant complexity for very small 
extra gain.



More information about the Digitalmars-d mailing list