Null references (oh no, not again!)

Christopher Wright dhasenan at gmail.com
Tue Mar 3 15:57:26 PST 2009


Daniel Keep wrote:
> Just noticed this hit Slashdot, and thought I might repost the abstract
> here.
> 
> http://qconlondon.com/london-2009/presentation/Null+References:+The+Billion+Dollar+Mistake
> 
>> I call it my billion-dollar mistake. It was the invention of the null
>> reference in 1965. [...] This has led to innumerable errors,
>> vulnerabilities, and system crashes, which have probably caused a
>> billion dollars of pain and damage in the last forty years. [...] More
>> recent programming languages like Spec# have introduced declarations
>> for non-null references. This is the solution, which I rejected in
>> 1965.
> 
>   -- Sir Charles Hoare, Inventor of QuickSort, Turing Award Winner
> 
> Serendipitous, since I just spent today trying to track down an
> (expletives deleted) obscure null dereference problem.  I figure I must
> be in good company if even the guy who invented null doesn't like it...

There are issues shoe-horning non-nullables into a nullable world:
  - preallocating arrays (or static arrays)
  - structs with non-nullable fields
  - pointers to non-nullables

It's sufficient that I gave up on my attempts to implement it.

If it were implemented, non-nullable absolutely must be the default. I'm 
still sad about mutable being the default in d2.



More information about the Digitalmars-d mailing list