Thursday, March 01, 2007

What about Lisp?

What about this oldy, Common Lisp? Great language overall. Some glitches here and there.

Skipping the dispute about strictly functional vs tolerable imperative, lisp is a great language for expressing yourself in the most intimate way allowed by a programming language. Using programming patterns makes a good programmer, but creating your own also makes a happy programmer.

There's a permanent need in lisp to write code in an awkward manner. This sometimes leads to frustration but most often is compensated by the sheer joy of being able to express everything as it comes to mind and not having to convert things to a preexisting grammar-enforced pattern of thought.
The main reasons for frustration that are frequently mentioned are:

1. parentheses - There's too many of them. Even with parens-match highlighting or other nifty tricks like list depth color-codes the lines blurr until you exercise your focus skill.
2. prefix notation - It's hard to get used to this. The normal pattern of thought is to apply transformations on lists from left to right. Sometimes even after gaining some experience with the prefix form (when you start feeling good about writing parens) you still think in left to right transformations so you actually do a manual conversion from left to right to prefix notation.
3. notations for symbol list creation - They get very confusing. And it's not just about the level of indirection (symbol to value stuff). When you start using macros the first thing you learn is about the back-tick operator and it's associated ',' expression evaluation. This is just crazy when used recursively.
4. list construction - When constructing lists that are not quoted you must specify every time a list construction function like list or maybe use an abbreviation like '@' (@ x 2 (@ y 5))

Any programming language that has a decent grammar (Haskell, Python, Ruby) doesn't have these problems but neither does it have the power inherent to lisp. Some of those things that make lisp better:

1. Expressions can be inserted almost everywhere in an existing code. This is why ideas can be expressed straight-forward as they come to mind.
2. Macros provide compile time AST parsing and restructuring.
3. Macros can also be considered to provide compile time lazy evaluation of expressions.
4. Uniform syntax for any kind of function/operator (the prefix notation).
5. Quoting allows having direct access to symbols. You are not forced to use strings, can manipulate literals in the code directly.

There are many others but let's just not get carried away. All these said lisp is great for being happy with yourself but not really caring about working with others. The sparseness of ready to use modules/packages creates a barrier for the beginner, too varied coding patterns creates a barrier for a possible community. Too many barriers are discouraging to brake. Those that do succeed create a "group" of solitary individuals and do not try to brake the final barrier: share what you create.

2 comments:

Anonymous said...

One word for you, my friend: Perl6 :P

Anonymous said...

Neah... SUBIX 1.0 ;)