Null references (oh no, not again!)

Daniel Keep daniel.keep.lists at gmail.com
Tue Mar 3 18:33:39 PST 2009



Andrei Alexandrescu wrote:
> I suggested to Walter an idea he quite took to: offering the ability of
> disabling the default constructor. This is because at root any null
> pointer was a pointer created with its default constructor. The feature
> has some interesting subtleties to it but is nothing out of the ordinary
> and the code must be written anyway for typechecking invariant
> constructors.
> 
> That, together with the up-and-coming alias this feature, will allow the
> creation of the "perfect" NonNull!(T) type constructor (along with many
> other cool things). I empathize with those who think non-null should be
> the default, but probably that won't fly with Walter.
> 
> 
> Andrei

If Walter can get this working so that we can create NonNull as a
wrapper struct that guarantees it will always be non-null, that'll be a
big step forward.

Yes, I'd prefer it be the default, but better possible than not.  :)

  -- Daniel



More information about the Digitalmars-d mailing list