19th of September, 2012
Things like this bug are why everybody should be using Haskell.
In particular, the people programming the HTTP package of Golang are very good programmers; but they have that bug—caused by having liberated state—and they cannot even fix it, because … well, because they are not using Haskell. (I say “Haskell” here as a style and approach, more than as a language; but either way, the meaning is safe.)
When you have state, you have an infinite number of code paths that could surprise you. This is not about being a good programmer and safeguarding against the paths you don’t want. Au contraire, it is about being a good programmer and realising that “liberated state → bug”. (And being a philosopher enough to know that there can be no qualitative definition of “liberated”. Software is art, not science. Forget the lies.)
Until 1931, the Western mathematicians were looking for a logical structure that could define mathematics in all its infinite “code paths”. Gödel showed them that their efforts were futile; and yet they continued even after his theorems came out. (Hilbert’s program continued; Lord Bertrand Russell’s program ended for different reasons.) To this day, many seek to prove things—or think they can prove things—which are clearly impossible due to the fact of Gödel’s Incompleteness Theorems.
The same is true of the programming styles that we use today. A lot of programming today proceeds as though you can have a program that has free state (as in freed, liberated state) and also have that program be bug-free and intelligible. This is a fallacy. Even the best programmers cannot achieve that; just as the brilliance of Hilbert and Lord Russell put together could never save mathematics from the implications of the incompleteness theorems.
I am paranoid when I use languages that have free state. At least we should have purity with state introduced carefully, rather than having state where we introduce purity selectively. Give me Haskell or give me another task.