[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Macros -> declarations



    I don't buy this as a counterargument to what KMP said.  Subsitute "DEFUN"
    for "DECLARE" in the above paragraph.    You can only define functions with
    DEFUN -- (generic)Lisp provides no other way.  Yet, we have the whole
    top-level macro mechanism to allow you to define application-language-embedded
    function-definers, calls to whom are expanded at top-level to ultimately
    produce DEFUNs.  DECLARE is the only way to declare things lexically.
    The same arguments apply.

I guess I didn't make myself clear.  I understand that macros are able
to provide suitable disguises for anything that takes the form of a list
to be evaluated, such as DEFUN, and that this is useful in creating
embedded sublanguages with a LIsp-like syntax.  My point was that we do not
have anything like macros for disguising "structural" items that are not
in the form of lists to be evaluated: argument lists, things like
&optional, T and NIL, certain keywords, declarations, components of
declarations, doc strings, and so on.  Various parts of the interpreter
look for such things verbatim, without doing any macro-expansion of
objects or structures that might turn into the item being sought.

That's good for efficiency, particularly in the presence of MACROLET,
and gives the human reader of Lisp code at least a few stable landmarks
to hold on to.  The price is that if you really want to monkey around
with these structural things in an embedded language, you have to
transform the whole surrounding form and not just the item itself.  To
me that seems like a reasonable price for those people who want an
embedded language that departs from Lisp syntax in such a deep way.  If
you get rid of parentheses or prefix notation or argument lists, you'll
have to do a transformation on the whole form anyway; I'm just saying
that we could reasonably consider declarations to be something basic to
the syntax of the language, like argument lists, rather than thinking
of them as a funny kind of body form.  Just because (DECLARE ...) looks
like any old lisp form, that doesn't mean we have to treat it as one.

-- Scott