
Not Everything is an Expression (2016) - hyperpape
http://www.rntz.net/post/2016-06-06-not-everything-is-an-expression.html
======
fiddlerwoaroof
It's fairly simple to write an extensible macro in common lisp, if you
leverage CLOS's eql specializers:

[http://paste.lisp.org/display/353777](http://paste.lisp.org/display/353777)

Also, using symbols in an eql specializer like this lets you leverage Common
Lisp's package system for namespacing your extensions.

------
kmill
Common Lisp acknowledges at least one syntax class: setf forms[1].

[1]
[http://www.lispworks.com/documentation/HyperSpec/Body/m_defs...](http://www.lispworks.com/documentation/HyperSpec/Body/m_defset.htm)

~~~
kazinator
Another one is, for example, the "lambda list" and "macro/destructuring lambda
list".

We can write some new macro and say that the "foo argument is a destructuring
lambda list". The macro then inserts that into the target code in some way
that it is interpreted that way.

Yes, however, in CL terminology, everything in fact is an expression. In _(let
((a b)) ...)`,_ (a b)* is an expression. What is is _not_ is a _form_ : an
expression intended to be evaluated. Not every expression is a form.

(Other dialects may have different terminology).

~~~
kmill
Source:
[http://www.lispworks.com/documentation/HyperSpec/Body/26_glo...](http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_e.htm#expression)

It is interesting that when people say "everything is an expression," they
usually seem to mean that "everything evaluates to a value," as a contrast to
the expression/statement dichotomy in most other languages. But (summarizing)
as far as Common Lisp is concerned, an "expression" is the object of what one
expresses.

Let expression1 mean the syntax class of expressions-with-values (like
mathematical expressions) and expression2 be the Common Lisp definition. Then
it's "in Lisp, everything is an expression2" and "every form is an
expression1." This ambiguity might explain the surprise when realizing Lisp in
fact has other syntax classes than expression1s.

