| > I'm always a little puzzled when I read the argument that "nil costs billions of $". $1bn over the history of computing is about $2k per hour. I would not be astonished if a class of bugs cost that much across the industry. > most of the expensive bugs in C/C++ programs are caused by undefined behaviors Sure, there are worse bugs. Why, then, waste our time tracking down trivial ones? > Why does Haskell let me write `head []` (and fail at runtime) ? Because the Prelude is poorly designed. > How is that different from a nil dereference exception ? It's not different, really. It's a very bad idea. > People never complain about this Yes we do. We complain about it all the time. It is, however, mitigateable by a library[1] (at least partially), whereas nil is not. [1] http://haddock.stackage.org/lts-5.4/safe-0.3.9/Safe.html#v:h... |
It's not about knowing whether it's $1bn, or 10bn, or just a few millions. The question is to know whether fighting so hard to make these bugs (the "caught at runtime" version, not the "undefined consequences" version) impossible is worth the cost or not.
Can you guarantee that hiring a team of experienced Haskell developers (or pick any strongly-typed language of your choice) will cost me less than hiring a team of experienced Go developers (all costs included, i.e from development and maintenance cost to loss of business after a catastrophic bug)? Can you even give me an exemple of a business that lost tons of money because of some kind of NullPointerException ?