|
|
|
|
|
by foobarbaz1234
4245 days ago
|
|
I am a fan of Scheme but never got that statement. Why do people say Scheme/Lisp has no syntax? I mean clearly it has a _simple_ syntax, i.e. an expression is either an atom (an identifier, a number, a lambda expression, etc.) or a list of expressions, denoated by "(expr0 expr1 ... exprN). I would say it has a simple, well-thought and powerful syntax. |
|
Then again, not just every Lisp dialect but even pretty much every implementation has its own s-expression parser with its own extensions to s-expression syntax to make it most convenient to write code in, so there's not a very good decoupling after all. :-P Nevertheless it provides some benefits. Like being able to use something like "paredit" to edit code structurally, and making macro systems somewhat simpler (though hygienic macro systems cannot work with pure s-expression data; it must be annotated with lexical context).
You might find it hard to believe but I love Lisp syntax with all of its parentheses, and am explicitly against, for example, Sweet Expressions (SRFI-110). (Though SRFI-105 is fine.)
By the way another meaning of the word "syntax" actually refers to something within the data structures after the actual concrete syntax has been parsed away. For example when you have a list and its first element is the symbol "if", then that list is a usage of the if syntax. This syntax takes three arguments (further elements of the list): a test, consequent, and alternative. So "syntax" is something like a function here, except it operates during compilation and its arguments are unevaluated sub-structures (roughly, code snippets, though the syntax could interpret them however it wants, like for example how the "lambda" syntax's first argument is a parameter list). That's why we can say "in other languages you can only implement new functions; in Lisp you can also implement new syntax." (In the form of macros.)