The debate about adding closures to Java has spawned a curious debate about the role of explicit loops, recursion and higher-order list combinators. I wonder why no one has stepped up in defense of GOTO yet.

Misguided Java snob Elliot Harold harangues fist and teeth against progress in computer languages:

I don’t know what it is some people have against for loops that they’re so eager to get rid of them. This isn’t the first or even the second time CS theorists have revolted against for loops (or equivalent).

This isn’t even the most proeminent below-the-belt jab at new expressive techniques. Take this cheap shot at Haskell by Python’s dictador buenito Guido van Rossum*:

It is a strongly typed pure functional language, where just about everything is written as recursive functions, because the language has no looping construct. Because of this it will probably always remain a language of mostly academic interest: loops may be theoretically inferior to recursion, but I have no doubt that the human brain has special reasoning abilities for loops, and many real-world problems are most naturally expressed using loops rather than recursion.

Being the nice guys on the block, the Haskeller response is oh, but wait, the traditional Bird-Merteens/Standard Prelude functions are kinda expressive too, you know. Which is fine and quite useful for bystanders trying to evaluate this debate on merit alone. I myself should repackage the section in this endless meandering rambling on program transformations; I still believe that the moment the masses figure out about map fusion, their brains are going to spontaneously explode, hurting and maybe killing thousands of others with skull bone pieces.

What I intend to submit here, though, is that this isn’t a technical debate: the “they will have to forcefully extract my for loops from my cold, dead hands” contingent is probably moved by three main nontechnical motivations:

Bone-headed resistance to change: this may come out as shocking to the likely audience of this blog, but.. many (probably most) people hate learning new stuff. The writing’s on the wall: monads in VB.net, closures and type-classes in Java, a ML in Microsoft’s .NET, etc seem all to point towards increasing importance of functional programming techniques in this “real world” the loop apologists seem to enjoy talking about, and when the levee breaks, the ordinary programmers they stand for — I want to believe Guido understands the basic FP CS101 students understand — will have to learn something new. Vested interest in current technologies; for example, this Elliote Harold bloke who seems to have kickstarted the debate in the blogs, has written dozens of books on current dominant technologies; he’d sure like to be able to milk that cow for a while. Vested interests in making simple software complex; there is, after all, an entire industry built on maintaining 10k-lines code that sums a few numbers and prints out the result. Note that I’m not saying there’s a vast conspiracy; Microsoft, Sun, etc. are out there to sell whatever people are buying, and if people are buying new programming paradigms, more power for them. But how many consultancy models would go bust if Haskell-style functional programming was to rise to mainstream? I’m pretty sure map fusion alone would bust one fourth of the current “refactoring” pundit market.

Maybe I’m coming across as cynical, but it’s just a little economist-think at work. Functional programming is not crackpot science that would make people this passionate to fight out against.

If functional programming was an academic wonder with no place in the real world of software engineering — like countless other academic wonders out there trying to make a break into actual practice — would it attract this kind of slander?

*(Guido is in fact trying to sell the idea that functional program is merely a matter of occasional syntactic convenience; about this particular [blatant lie | stupid, stupid slip], I fully, heartily endorse Xah Lee‘s harsh words, rude expletives and all).