for Whom The Bell Tolls

09Feb07

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:

  1. 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.
  2. 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.
  3. 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).



8 Responses to “for Whom The Bell Tolls”

  1. I think there is a bit of a communication and education problem as well. Maybe you’d file it under 1b. Most if not all basic tutorials start with factorial and fibonacci, right? So the first thing people see is recursion, which is a bit alien. They think, you want to take away my loops and give me this instead?

    A lot of new learners never get to the point of understanding that you basically never write an explicit looping construct or recursive function in Haskell. That is, Haskell really wants to take away your loops and have you work at a higher level of abstraction where you don’t even think about silly things like that.

    As much as I admire your cynicism, I think Haskellers have to bear some of the responsibility for the confusion. We’ve allowed the debate to be framed in “their” terms — loops vs. recursion — instead of loops vs. “just say what, not how”.

  2. I was originally gonna take that angle — declarative vs imperative — but decided to keep the rant short this time. Thanks for your mindful comment ;)

  3. 3 Imam Tashdid ul Alam

    what is dons who said he doesn’t _want_ Haskell to be popular because he enjoys the productivity exclusive to _himself_ around dysfunctional people?

  4. 4 Imam Tashdid ul Alam

    typo :$, starts with “was it ..”

  5. 5 Paul Prescod

    Rant indeed.

    Elliotte Rusty Harold didn’t once mention Haskell. He did mention functional programming once: “Thus the closure syntax and the for syntax really aren’t equivalent and closures can’t replace for loops. They might supplement them, but this is only relevant if they really can be run on multiple processors simultaneously. In functional systems, this works because there are no side-effects. Thread safety is almost free. However, this isn’t true in Java.”

    So once again he didn’t slam functional programming languages, and in fact said something quite positive about them.

    With respect to Guido’s comment: I really don’t think that there is any need for cynicism. You say: “Functional programming is not crackpot science that would make people this passionate to fight out against.” Ummm. There was nothing remotely passionate in Guido’s quote. In fact, he said “the talk I most enjoyed was neither about Python nor about C++, but about Haskell and Haskell is incredibly expressive – and not just because it uses a very sparse syntax.”

    Reading the three blog posts, the only one that is passionate, vested and slanderous is yours. The others come across as mostly disinterested but mildly curious about Haskell.

  6. 6 Paul Prescod

    A couple more thoughts. First: I am hardly a disinterested observer, as I count both Guido and Elliotte as friends and as major contributors to the software industry.

    Second: the thing you keep missing while reading their posts is that for the most part they are talking about what is right for THEIR LANGUAGE, not what is right for Haskell or even the industry at large. Guido wants to take functional features out of Python because those features DO NOT make Python a functional language. Elliotte wants to leave them out of Java for the same reason.

    Yes, Guido did say something negative about Haskell per se, and you have the right to address that. But you also refer to his blog and the debate about reduce(). Guido can rip out functional features from Python without slandering Haskell for the same reason he can leave out features from Prolog or XSLT or Erlang without disparaging those languages.

    In summary: you need to sit back, take a few deep breaths and realize that not everything anyone says in the blogosphere is intended to either praise or disparage Haskell. Some people have their own lives programming in their own languages and want to keep those languages simple within their own paradigms. That just leaves more room for Haskell and its siblings to differentiate themselves.

    Deep breaths.

    As a reformed language advocate myself, I actually would appreciate your vitrol if it were directed at technology and not people.

  7. 1) Guido is demonstrably not an idiot, and I think you should probably give him the benefit of the doubt. Not that you need to agree with him, but you could argue logically instead of by dismissive name-calling.

    2) I think you should look up Xah’s usenet posting history before you back him too much. Not that he might not be right on this issue (I haven’t read the thread), but he’s a serially vulgar cross-posting lunatic who writes ignorant screeds.

    3) You don’t come across as cynical, you come across as arrogant and singlemindedly dismissive.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: