Null references redux

Rainer Deyke rainerd at eldwood.com
Tue Sep 29 14:30:58 PDT 2009


Jeremie Pelletier wrote:
> struct NonNull(C) if(is(C == class)) {
>     C ref;
>     invariant() { assert(ref !is null); }
>     T opDot() { return ref; }
> }

This only catches null errors at runtime.  The whole point of a non-null
type is to catch null errors at compile time.


-- 
Rainer Deyke - rainerd at eldwood.com



More information about the Digitalmars-d mailing list