(non)nullable types

Christopher Wright dhasenan at gmail.com
Wed Feb 11 12:40:01 PST 2009


Sebastian Biallas wrote:
> Christopher Wright wrote:
>> Oh, and I vote no. I think it's needless complexity. I code without 
>> any special care for null objects, and I get a segfault or 
>> NullReferenceException maybe once a week, probably less. I've always 
>> been able to track down the bug very quickly.
> 
> That misses the point completely. It's not about you (as the programmer) 
> getting NPEs; it's about the user getting bug-free software in the first 
> place.
> 
> In most cases a segfault/NPE is easy to track down for the programmer, I 
> guess nobody would object to this. But once the software is shipped, 
> it's a very serious problem: It's a situation the programmer didn't 
> thought about so you usually have a data loss.

Your language features should get rid of bugs that are easy to make and 
difficult to track down. It's not worthwhile to alter your language to 
remove easily found, easily fixed bugs.

Logic errors are difficult to find. Your language cannot help you 
eliminate those (though contracts and unittests can help you find them). 
If you do not test your software extensively, you will ship software 
with logic errors. The testing required to find logic errors will also 
find low-level errors like segfaults.



More information about the Digitalmars-d mailing list