Null references redux

Rainer Deyke rainerd at eldwood.com
Tue Sep 29 18:57:27 PDT 2009


Jeremie Pelletier wrote:
> Rainer Deyke wrote:
>> This only catches null errors at runtime.  The whole point of a non-null
>> type is to catch null errors at compile time.
>>
> 
> Thats what flow analysis is for, since these are mostly uninitialized
> variables rather than null ones.

Nitpick: there are no uninitialized variables in D (unless you
especially request them).  There are explicitly initialized variables
and default-initialized variables.

I can see the argument for disabling default initialization and
requiring explicit initialization.  You don't even need flow analysis
for that.  However, that doesn't address the problem that non-null
references are intended to solve.  It's still possible to explicitly
store a null values in non-null references without the problem being
detected at compile time.


-- 
Rainer Deyke - rainerd at eldwood.com



More information about the Digitalmars-d mailing list