Tuesday, April 18, 2006

Lisp: Paul Graham? Too many Lisps?

I didn't mean to create a blog.



I read a critique of Lisp in another blog, and felt moved to respond. But the space for the comments seemed so cramped. It seemed like a bright idea to create my own blog and defend my favorite programming language at length. (As if I don't have a million better things to do.)



The critique was by Steve Yegge. He said several things, but let me mention two: that Lisp's recent increase in popularity is due to Paul Graham; and that there are too many Lisps to choose from.



The first seems absurd to me, but I don't know how to evaluate it. I thought Lisp was making a modest (very modest) comeback because Java had made garbage collection respectable; or because of the not unrelated fact that computers have gotten so fast that some of Lisp's inefficiencies (and Java's, and Python's) can be overlooked. Enough intro-CS courses expose students to Scheme that the idea of Lisp keeps rippling through impressionable young minds.
John McCarthy once said that Lisp seems to be a lucky discovery of a local maximum in the space of programming languages. Plenty of people are happy finding the top of that particular hill. Others have slightly different objective functions.



I've never met Paul Graham or heard him speak. I gather he's exciting to listen to. If he's helped keep fuel in Lisp's tank, that's great. But I think comp.lang.lisp has been a greater source of inspiration for people coming into the Lisp community, as have ALU, Cliki, and other such.



Another point Mr. Yegge made was that there are too many Lisps to choose from, making life difficult for the beginner (as compared to the beginning Python programmer). I've noticed that there are too many GNU/Linux versions out there. Sometimes that's just the way it is.



However, in the case of Lisp there's a deeper point to be made. It's in the nature of Lisp that it grows in many directions simultaneously outside of central control. I have myself posted a macro package called YTools
that transforms Lisp into a streamlined power demon or into an unreadable mess. (People differ on this issue.) I have another called Nisp that adds strong static typing to Lisp. I find I can't get along without these tools. Other people have other tools that they make available, some of which have caught on with a wider community although most have not.



The situation is not different with other programming languages, except that in the case of Lisp tool packages make syntactic extensions to the core language. If this whole idea gives you the willies, stay away from Lisp. If it sounds intriguing, you might still want to stay away, because Lisp can be addictive. I never program in any other language if I can help it. (My job involves teaching intro programming, which requires me to write simple Java programs, which I find fun. I've occasionally had to write some C or C++ code to run on a robot. I once had to hack Latex2HTML to fix some bugs, which convinced me that programming in Perl was something I should try to avoid if possible.)



There is a portability problem with Lisp, although in my experience it's not quite what one might expect. 90% of the bugs I find when porting from one CL to another are cases where the original implementation was too forgiving of departures from the language standard. A program that's worked fine for years can be ported to a different implementation where you find out it's buggy. I don't know what to say about this except that (a) I've learned that keeping a suite of tests around for any piece of software is a good idea; and (b) YTools and Nisp at this point have been ported and tested on Allegro, CMU Lisp, CLISP, and Open Macintosh CL. Getting them cleaned up was an exercise in anality, but they certainly are superstable as a result of the exercise.

5 comments:

Anonymous said...

Could you please elaborate on why case-insensitivity in Common Lisp is a mis-feature? With such a large set of variable names possible, I was under the impression that case was truly irrelevant to the language (and the worst case of |CamelCase and lowercase and WHITESPACE| are still possible).

I am not an expert in CL but do love the language very much.

airfoyle said...

I'm afraid I don't get your argument. "With such a large set of variable names possible" — a larger set than for other languages? Why is Lisp the only language whose identifiers are not case-sensitive?

When Lisp was created, programs were still being input on punched cards, so all symbols were upper case. As the language evolved, a series of decisions were made to preserve backwards compatibility, and while each decision may have made sense, they got us to a point no one would choose if designing the language from scratch.

For some concrete ways in which case-insensitivity causes problems, look at
the discussion of modern mode

in the Allegro Lisp documentation. But aesthetics alone should be sufficient to reject it.

Nate C-K said...

Most languages that have only one canonical implementation are in this situation because:

- they are very young (Python, Ruby, etc.)
- they are difficult to implement and have no published standards (Perl)
- they aren't very popular (Erlang)

Most successful languages older than about 1990 have many different implementations.

Languages with many implementations include: Lisp, Scheme, C, Fortran, C++, Pascal, ML, BASIC, Smalltalk, the Bourne shell, SQL, Javascript, Java. (And Java would be more diverse now had Sun not essentially sued Microsoft's variant out of existence.)

Multiple implementations are a sign of success.

Visual Basic, one of the most popular languages of all time, is also case-insensitive. I've never heard anyone complain about it. Case sensitive identifiers really add nothing to the language except for a new potential source of bugs.

Anonymous said...

The information here is great. I will invite my friends here.

Thanks

Anonymous said...

Do you have copy writer for so good articles? If so please give me contacts, because this really rocks! :)