3 ms·
After using languages with the Option type [0] and exhaustive pattern matching [1] (OCaml was my first exposure), I can definitely say that bare null pointers,
by satvikpendem 4y ago
After using languages with the Option type [0] and exhaustive pattern matching [1] (OCaml was my first exposure), I can definitely say that bare null pointers, without using the prior two things I mentioned, are a mistake.
It's not that null as a concept is a mistake, since a Option type has both Some and None, it's that in most mainstream languages, people have to implicitly deal with them rather than having the compiler checking it for them explicitly. And if the computer can check our work for us, why do we have to do it ourselves?
That's why it leads to mistakes and is why it's called a billion dollar mistake, because I'm sure at least 1 billion (possibly even 1 trillion) dollars worth of manpower, lost revenue and time have been spent dealing with nulls.
[0] https://en.wikipedia.org/wiki/Option_type https://en.wikipedia.org/wiki/Option_type
[1] https://en.wikipedia.org/wiki/Standard_ML#Pattern_matching https://en.wikipedia.org/wiki/Standard_ML#Pattern_matching
- deleted 4y ago[deleted]