Tony Hoare Calls Inventing the Null Reference His Billion-Dollar Mistake
He added it to ALGOL W in 1965 because the compiler made it easy. Six decades of crashes followed.
C. A. R. Hoare won the 1980 Turing Award for sorting algorithms and the formal verification of programs. Three decades earlier, in 1965, he was helping Niklaus Wirth design ALGOL W, an Oxford-Stanford successor to ALGOL 60. The language needed a way to express 'this object reference points at no object yet.' Hoare added a null reference. He did it, by his later admission, because the compiler implementation was easy.
He spent the rest of his career watching that decision propagate. ALGOL W's null became Pascal's nil, Smalltalk's nil, C's NULL, Java's null, JavaScript's null and undefined. In every language that adopted it, programs began throwing null-pointer exceptions: dereferencing a reference that was supposed to point to something but did not. The error is the single most common runtime failure in object-oriented systems.
In August 2009, at the QCon London software conference, Hoare gave a talk titled 'Null References: The Billion Dollar Mistake.' He said the dollar figure was a guess, but a conservative one — counting only the bugs, vulnerabilities, and crashes attributable to null references over the prior 40 years.
The correction has been slow. ML and Haskell, descended from a different lineage, never had nulls; they expressed absence with an Option or Maybe type whose nothingness is checked at compile time. Newer mainstream languages have caught up. Rust's references are non-null by definition; absence is Option<T>. Kotlin, designed in 2011 to coexist with Java, distinguishes nullable and non-nullable types in the type system. Swift made the same choice with optionals. The pattern is the same: take the runtime crash and make it a compile error.
The billion-dollar mistake is fixable. It just takes a generation.
Make Recess yours.
Sign in to save the ones you loved, never see the same thing twice, and tell us what you want more of.