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

Why does my Macro get expanded 8 times?



    Date: Mon, 11 Jul 88 22:33:39 PDT
    From: gyro@kestrel.ARPA (Scott B. Layson)

    To prevent multiple macro expansion, you could make your macro a
    so-called "displacing" macro, using ZL:DEFMACRO-DISPLACE.  This will
    cause it to modify the the cons which is the head of the form that
    invokes the macro (got that?), effectively caching the expansion
    there.  (Try it to see the details; it's really pretty
    straightforward.)

    SCRC folks: surely one of the ways you considered fixing the problem
    was to make all macros displace in Phase I.  Why doesn't this work?

Because the expansion of a macro depends on the environment in which the
macro is expaneded.  If you trace the macroexpansions, you'll find that
the expansions of the same form are (almost always) in different
environments.