3 ms·
Nils are a very bad code smell. They come from C's null, which is a billion dollar mistake[1], according to its creator: Tonny Hoare. Specially now that we have
by aphyr 15y ago
Nils are a very bad code smell. They come from C's null, which is a billion dollar mistake[1], according to its creator: Tonny Hoare. Specially now that we have monads[2, 3].
Do you have a source for this? I was under the impression nil was directly taken from Smalltalk, which derived it from Lisp.
- DanielRibeiro 15y agoWikipedia[1] has the refs: The null reference was invented by C.A.R. Hoare in 1965 as part of the Algol W language. Hoare later (2009) described his invention as a "billion-dollar mistake":[10][11] [1] http://en.wikipedia.org/wiki/Null_pointer#Null_pointer http://en.wikipedia.org/wiki/Null_pointer#Null_pointer Where: [10] http://qconlondon.com/london-2009/presentation/Null+References:+The+Billion+Dollar+Mistake http://qconlondon.com/london-2009/presentation/Null+Referenc... [11] http://www.infoq.com/presentations/Null-References-The-Billion-Dollar-Mistake-Tony-Hoare http://www.infoq.com/presentations/Null-References-The-Billi... Yes, the same video I linked above.
- aphyr 15y agoNil was a part of Lisp 1, which is why I was confused. It predates Algol W by seven years. As null references and nil are somewhat different beasts, I'm not sure the criticism "billion dollar mistake" applies fully.