Thursday, November 26, 2015

Blame it on John

So, I'm catching up on my reading in Sebesta for Languages and he's pretty quick to lay the whole rejection of functional programming at the feet of the Von Neumann architecture. I won't reprise earlier my rant on that one, except to restate that the trends in programming over the last 20 years are pretty clear refutation of the assertion that machine efficiency is the limiting factor in language design.

So, if it's not because the hardware can't support it (it can; I've written plenty of production code in F#; it works just fine on a standard machine), what is it? Even my comments about side effects miss the mark because ALL production-ready functional languages permit side effects; they just make them a bit less convenient.

At least some of it is at the core of our own use of language as humans. Programmers are people, and when people want something done, we tend to start barking out orders. Stating an objective in terms of requirements rather than actions is just as difficult (maybe more so) for programmers as it is for anybody else. And, it's not just a failing on the part of the speaker. I recently said "Why is the garbage full?" and got an earful for being passive aggressive. From now on, I'll say "Take out the garbage!" I might even throw "dammit" in there somewhere which is pretty much the antithesis of declarative. (BTW, there is no sexism going on here. Kate and I each do plenty of housework; the garbage just happens to be on her list).

Thinking of computation as declarative really only makes sense to mathematicians. And, while I'm happy to be counted among their lot, I also realize that we comprise a tiny fraction of the human race. Stating n! as {1 if n = 1; n (n-1)! otherwise} may seem elegant to a few, but most would much rather I just told them to multiply all the numbers from 1 to n.

No comments:

Post a Comment