Vincent Gable’s Blog

December 10, 2009

Being a Lisp is a Handicap

Filed under: Accessibility,Programming | , , , ,
― Vincent Gable on December 10, 2009

Being a Lisp Is a Handicap

There are a large number of people who find Lisp code hard to read. I’m one of them. I’m fully prepared to admit that this is a shortcoming in myself not Lisp, but I think the shortcoming is widely shared.

Perhaps if I’d learned Lisp before plunging into the procedural mainstream, I wouldn’t have this problem — but it’s not clear the results of MIT’s decades-long experiment in doing so would support that hypothesis.

I think it’s worse than that. In school, we all learn
3 + 4 = 7 and then
sin(?/2) = 1
and then many of us speak languages with infix verbs. So Lisp is fighting uphill.

It also may be the case that there’s something about some human minds that has trouble with thinking about data list-at-a-time rather than item-at-a-time

I think I really totally understand the value of being homoiconic, and the awesome power of macros, and the notion of the reader. I want to like Lisp; but I think readability is an insanely important characteristic in programming systems.

Practically speaking, this means that it’d be hard for me to go out there on Sun’s (or Oracle’s) behalf and tell them that the way to take the best advantage of modern many-core hardware is to start with S-Expressions before breakfast.

Tim Bray (emphasis mine)

I’m afraid he’s on to something. We have an amazing ability to parse language. But people aren’t terribly good at building the kinds of stacks needed to parse LISP with their short term memory.

This is the cheese that the rat that the cat that the dog that the neighbor owned bothered chased ate.

Say what?!

(This is the cheese (that the rat (that the cat (that the dog (that the neighbor owned) bothered) chased) ate)).

See the LISP connection?

All functional languages are fighting an uphill battle to be understood. The world we evolved in is stateful (modal) and imperative. We navigate it in a me-at-a-time way. Unfortunately, LISP’s prefix syntax is another, unnecessary, barrier.

The bottom line is that every word of code spends more time being read than written — so writing in a syntax that most people have a hard time reading is one of the worst programming choices imaginable. I believe functional programming languages are well worth learning; but I don’t believe it’s worth suffering a poor syntax.

3 Comments »

  1. Scheme’s a Lisp variant with hygienic macros for infix operators.

    Vincent Says:(Fixed the typos you mentioned, thanks!)

    Comment by Jason Petersen — December 10, 2009 @ 3:14 am

  2. All the scheme code I’ve seen was still ((()))-soup, unfortunately.

    Comment by Vincent Gable — December 10, 2009 @ 4:01 am

  3. I’ve heard these arguments against Lisp and I don’t buy them.

    The only thing infix in other programming languages is generally simple math. It is not that hard to make an infix notation for math in most Lisps using macros and the reader. But after using Lisp for a while, you probably would not want to.

    The benefit you get from the parenthesis and the homoiconicity is the macro ability. I have never seen any other languages that has anywhere near the ability of Lisp to write macros, and thereby significantly cut down on the code that you need to write, and the ability to better model your program after what you are really trying to accomplish. And for the record, I like the hygienic macros of Scheme better than those of Common Lisp. And if you do not understand the difference, you do not really understand macros.

    And as your comment about not being able to keep a stack deep enough to parse out Lisp expressions, most lisp functions are only a couple lines of code, well within the realm of being parsable by a human mind. One of the problems is that people who don’t know Lisp well write C++ code in Lisp and it’s a horrible mess. Look at some code by good Lisp hackers and it’s fairly readable.

    But, I am an unabashed Lisp hacker, so it’s just my $.02.

    Comment by cwbowron — December 10, 2009 @ 8:24 am

RSS feed for comments on this post.

Leave a comment

Powered by WordPress