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

the lexical environment for DEFTYPE, DEFINE-SETF-METHOD and



    Date: Sunday, 11 October 1987  23:49-EDT
    From: Pavel.pa at Xerox.COM
    To:   David Bein <pyrnj!pyramid!bein at RUTGERS.EDU>
    cc:   common-lisp at sail.stanford.edu
    Re:   the lexical environment for DEFTYPE, DEFINE-SETF-METHOD and
          DEFSETF

    [...] the description of DEFMACRO that states that the body of a
    DEFMACRO is evaluated in the null lexical environment.  This restriction
    was put in with the thought that it was necessary in order for the
    compiler to be able to macroexpand forms without evaluating the
    surrounding code to create a lexical environment.

    This argument, however, is bogus, since it is the lexical environment of
    the DEFMACRO, not that of the macro-call, that is important.  If a
    DEFMACRO appears in a non-null lexical environment, the compiler is not
    obliged to notice it at all (aside from compiling it correctly).  That
    is, later forms in the same file may not depend upon that macro having
    been installed.

If I believed in your proposed semantics for DEFMACRO, then I would
buy this argument, but I don't.  It seems to me to be a bizzarre
suggestion that the semantics of an operation should depend on whether
the environment is null or not.  I think that the only reason that
anyone buys this at all is that Lisp compilers have traditionally
magically special-cased forms that "appear at top-level", whatever
that means.

I think that there is a pretty convincing argument that the whole
concept of a "top-level form" is inappropriate in a lexically scoped
Lisp.  In my proposal for Common Lisp compilation (really evaluation)
semantics, I define things in a way that is consistent with general
usage, but makes no use of the concept "top level".

  Rob