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

Re: Potential issue: MACRO-SPECIAL-FORMS



Just a comment: I really believe that CLtL's goal of minimizing the
number of special forms that a code-analyzer has to understand by
relying on macros is misguided and non-achievable.  Consider Sandra's
experience, which I believe other people have had in other
implementations, with something that CLtL says is a macro, but the
compiler does a better job of compiling the macro call than of compiling
the nominally equivalent macro expansion.  Just consider how well CLtL's
goal has been achieved in practice:  not at all.

I think Common Lisp would do better to define everything that "everybody
knows" is a special form to be a special form; this would include all
the control structures, but not SETF.  My claim is that this would not
make it any more difficult to do code analysis, because in practice code
analyzers have to know about most of those forms anyway, and because the
extra work to make a typical code analyzer know about a typical special
form, even something as complicated as DO, is usually fairly small,
certainly less work than figuring out what weird macro expansions all
the implementations in the world will use for DO and making sure the
code analyzer works right for each of them.  This is even more true when
you use a pattern-driven code analyzer, such as the one I wrote in 1983
and have given to everyone who asked, or the one in Interlisp
MasterScope (which was my model, although I didn't look at the detailed
code).

An alternative position that I'd consider would be to mandate the exact
macro expansion of a number of these forms, not allowing implementations
to deviate.  Essentially that would be moving these things into a
portable library.  I suppose that might devolve into endles nitpicking
discussions that we don't need.