Via Lemonodor, a new article by Paul Graham, Revenge of the Nerds.
Believe it or not, there is a reason Lisp code looks so strange. Lisp doesn't look this way because it was designed by a bunch of pointy-headed academics. It was designed by pointy-headed academics, but they had hard-headed engineering reasons for making the syntax look so strange.
And yet these ideas turn out to be responsible for both Lisp's strange appearance and its most distinctive features. Lisp looks strange not so much because it has a strange syntax as because it has no syntax; you express programs directly in the parse trees that get built behind the scenes when other languages are parsed, and these trees are made of lists, which are Lisp data structures.
And this is awesome:
If you try to solve a hard problem, the question is not whether you will use a powerful enough language, but whether you will (a) use a powerful language, (b) write a de facto interpreter for one, or (c) yourself become a human compiler for one. We see this already begining to happen in the Python example, where we are in effect simulating the code that a compiler would generate to implement a lexical variable.
This practice is not only common, but institutionalized. For example, in the OO world you hear a good deal about "patterns". I wonder if these patterns are not sometimes evidence of case (c), the human compiler, at work. When I see patterns in my programs, I consider it a sign of trouble. The shape of a program should reflect only the problem it needs to solve. Any other regularity in the code is a sign, to me at least, that I'm using abstractions that aren't powerful enough-- often that I'm generating by hand the expansions of some macro that I need to write.
Wow
Also check out Design Patterns in Dynamic Programming by Peter Norvig, which Graham links to.
Finally, check out this story about a company (Orbitz) who used Lisp effectively in building its travel system. I got the link from http://imperialviolet.org/, but he has no permalinks!
See discussion on LtU. And funzel is right, Python does have lexical variables now.
Feel free to post a comment below. Please see my comment policy.
Formatting Rules (No HTML):