(non)nullable types

grauzone none at example.net
Thu Feb 12 05:30:43 PST 2009


> Thus, trigger a run-time assert does not help AT ALL. Only a 
> compile-time check will do.

I wouldn't mind if the compiler only inserted assert()s for me. Having 
to write these assert()s all over _and_ to write the documentation 
comments, that a parameter must not be null, is the most annoying thing. 
Doing it at runtime could save us from very annoying compiler behavior, 
and also simplifies the compiler implementation. (Wasn't D supposed to 
be simple for the compiler writer? It seems everyone forgot that, even 
Walter.)

By the way, I wouldn't suggest to make non-null the default. This would 
probably be too big of a language change. Instead, I'd propose to 
explicitly mark non-nullable reference with "!" (similar to "?").



More information about the Digitalmars-d mailing list