[article] Language Design Deal Breakers

deadalnix deadalnix at gmail.com
Mon May 27 00:59:32 PDT 2013


On Monday, 27 May 2013 at 07:45:41 UTC, Jonathan M Davis wrote:
> I don't see why. NotNull would statically prevent assigning 
> null to it (which
> is easy to do, since null has its own type) and will assert 
> that any
> references assigned to it are null. You then have the guarantee 
> that NotNull!T
> is never null. What would a built-in type do that that doesn't? 
> The one point
> where null could get in - when constructed from a nullable 
> reference - would
> have to be checked with a built-in type as well. The only way 
> to prevent it is
> to make it illegal to assign a nullable reference to a 
> non-nullable one and
> make it so that construction has to occur within the the 
> non-nullable
> reference - e.g. NotNull!T(args).
>

That is not enough. NotNull must be initialized, so the compiler 
have to track initialization in way it don't do today. This is 
the exact same processing required to ensure non null references.


More information about the Digitalmars-d mailing list