Sir Tony Hoare on inventing null while working on ALGOL (from wikipedia
below):

Speaking at a software conference called QCon London
<https://qconlondon.com/> in 2009, he apologised for inventing the null
reference <https://en.wikipedia.org/wiki/Null_pointer>:[23]
<https://en.wikipedia.org/wiki/Tony_Hoare#cite_note-23>

I call it my billion-dollar mistake. It was the invention of the null
reference in 1965. At that time, I was designing the first comprehensive
type system for references in an object oriented language (ALGOL W
<https://en.wikipedia.org/wiki/ALGOL_W>). My goal was to ensure that all
use of references should be absolutely safe, with checking performed
automatically by the compiler. But I couldn't resist the temptation to put
in a null reference, simply because it was so easy to implement. 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.

How about we stop passing nulls around as method arguments, field values,
return values, etc and use Optional instead? Benefits:
- No more NPEs
- Better documentation through code
- Less mistakes

I'm not suggesting we go rewrite everything, but rather just starting to
only return and accept Optionals in methods/constructors/etc.

Jad.

-- 
Jad Naous
Imply | VP R&D
650-521-3425
jad.na...@imply.io

Reply via email to