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

Code Generated by Macros



    Date: Wed, 24 Apr 85 12:58:16 EST
    From: greek@DEC-HUDSON

    We found that the following "macros" generated loops that hid a
    surrounding NIL block:

	    CCASE
	    CTYPECASE
	    DO-SYMBOLS et al
	    lots of compiler transformations (e.g., that turned a map
		    into a loop)

DO-SYMBOLS is clearly documented to create a block named NIL.

You're right that the others are errors.  Our implementation handles
these correctly, but perhaps you were talking about macro definitions in
some other implementation, such as Spice Lisp.  It's quite easy to do
them right.

    Also, of course, plenty of macros written by users can inadvertently
    cause the problem.

    The simplest way around is to only generate TAGBODYs.  Even PROG
    establishes a NIL block.

A good rule of thumb is never to use PROG under any circumstances for
anything.

The real problem is DO, which you would often like to use, but have
to be careful about whether you intended to create a block or not.
A good rule of thumb is to write macros whose name does not start
with "DO" in terms of BLOCK, LET, and TAGBODY only -- then everything
is explicit.