What Lispers seem to love, but others seem to hate.
Particularly C programmers, who are paradoxically often advised to 'parenthesize defensively' but see a language which does so by nature to be somehow distasteful.
The argument that programs with a mixture of parentheses and braces are easier for the programmer to format doesn't work: formatting can be done by editors with built-in pretty-printers such as Emacs.
There have been at least three attempts to get rid of the parentheses and move towards a more Algol-like notation: Lisp2, CGOL? and Dylan?. None of these has been particularly successful. This could be Lisp telling us something.
The parentheses are of course there so that program fragments can be treated as data, which is how macros work.
Attempts to reinvent the wheel include Curl, which has Lispish syntax but with braces in place of parentheses, and various languages with XML syntax such as Water.
And don't forget Python, which, while busily reinventing lisp in most respects, replaces parentheses with terrifyingly strict indentation rules.
So, why parentheses are needed in Lisp? What's their purpose? Indeed, if you don't have (lisp-like) macros, you don't really need parentheses, programmers can learn complex precedence rules, or add optional parentheses when needed. When you have parse-tree based macros, to be able to build the nodes of the parse tree (the s-expressions), you need to know how many arguments each operator takes. This information cannot be obtained from the operators because they're not necessarily defined when the expression is read and processed by a macro (forward definitions). Moreover, some operations may take a variable number of arguments, and then you will need to indicate how many argument a given call uses. Strictly speaking, we could use just a single expression terminator character, but given the idea of using lists to store the parse-tree, and given that we actually have expressions and not statement, a pair of surrounding parentheses is actually nicer than a terminating semi-colon.
Isn't it really about s-expressions? I certainly don't care if it is parentheses or square brackets or whathaveyounot. What I do care about is what s-expressions give me. Or perhaps, what they make so much easier for me to accomplish (manipulate code as data) compared to Python, et al.
After all, code is data. -- Erik Enge
[Well, one benefit of parentheses is that the left and right parentheses are more visually distinct from each other than (square) brackets, or braces, which are harder to tell apart in some fonts.]
This page is linked from: Fear of Lisp
CLiki pages can be edited by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively