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

Misfeature: macros expanding into declarations



    The Common Lisp feature of allowing a macro to expand into
declarations ought to be flushed; it complicates much code while
giving no useful return.  I suspect some of the complications were not
forseen when this feature was added to the language.  I believe that
the original purpose of this feature is subsumed by Deftype (which was
added later).

    The largest issue that I see is that writing macros that parse
declarations becomes much more complicated.  Every macro writer must
duplicate the non-trivial code which expands macros looking for
declarations.  Even if the macro writer goes to this trouble, a
subtlety that he is sure to miss is supplying the &environment keyword
to defmacro so that he can pass the lexical environment to
macroexpand.

    If this feature must remain, then there should be standard
functions for parsing declarations in the language.  This might not be
a bad idea anyway, but if the misfeature was eliminated there would be
no need to pass in the lexical environment.

    I won't even discuss the hair & inefficiency that this misfeature
adds to the system for fear of being accused of being a wimp or
interpreter weenie; anyone who has implemented a Common Lisp knows it
all too well.

  Rob