[cl-faq] faq answer: Lisp, ()'s, and indentation
Larry Clapp
larry at theclapp.org
Tue Nov 28 07:23:21 CST 2006
*** I have this cool idea for a new Lisp dialect / Lisp syntax that
doesn't involve so many parentheses! It uses indentation to show
structure!
Since the advent of Python, this comes up on c.l.l. with some
regularity. We've had "sweet-expressions" and "indented Lisp" and
probably others.
Realize a few things:
@ You should use an editor that makes writing Lisp easier, like
Emacs or Vim. Both of these can indent based on parenthesis
nesting, highlight matching parentheses, cut and paste entire blocks
of code based on the parentheses, and so on. If your editor can't
do all that, get a new editor.
@ Lispers already read code based on indentation, but their editors
indent and re-indent code automatically. \i{Removing} the
parentheses makes that \i{harder}.
@ After you've written and read enough Lisp, you stop seeing the
parentheses. (Reports, from actual newbies who've experienced it,
vary from a few days to a few weeks.) They don't \i{disappear} in
some magical way, but you start to see the structure of the code
rather than just "lots of fingernail clippings".
@ Parentheses are an accident of history. Any other matching
delimiter would work just as well.
@ Parentheses are an accident of syntax. They show block structure,
nothing more. You can view (a b c) as "(a b c)" or as
+------+ +------+ +---------+
| a | ---> | b | ---> | c | nil |
+------+ +------+ +---------+
Adding or removing parentheses -- or adding indentation -- to the
blocks-and-arrows notation makes no sense. To a Lisper that has
learned to recognize the () notation \i{as} the blocks-and-arrows
structure, it makes just as little sense.
@ Almost regardless of the actual merit (\i{*cough*} if any
\i{*cough*}) of your idea, most c.l.l.'ers (and probably other
Lispers, too) will greet your idea with derision and mockery.
More information about the cl-faq
mailing list