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

Why does my Macro get expanded 8 times?



    Date: Wed, 6 Jul 88 10:13 EDT
    From: DLA@JASPER.SCRC.Symbolics.COM (David L. Andre)

	Date: Sat, 2 Jul 88 00:41 EDT
	From: Salem@Think.COM (Jim Salem)

	If the definition of CLI::EXCASE were changed to have a NIL after the LET, ECASEs would
	macroexpand twice as fast.  [Anyone listening there at Symbolics ?]

    Okay, I fixed the our development system.  It will be in the Ivory
    release.

How does this manage to do the right thing?  According to CLtL p 60 you
can have any number of declarations and documentation strings (although
it's not clear what multiple doc strings imply) before the body of the
expression.  P 153 restates this for all cases where declarations may
appear.  So it seems that merely expanding the first form in the body
can't be enough; you have to keep expanding until you expand into
something which isn't a declaration (it doesn't appear that you can
expand into a documentation string, although if you allow a macro to
expand into a declaration, which I think is bogus, you should allow the
same for doc strings).

One way to improve this would be to use macromemo, and/or have a flag
which disables this "feature."