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

Reporting errors at macro-expansion time



   Date: Tue, 12 Jul 88 16:53 EDT
   From: DLA@jasper.scrc.symbolics.com (David L. Andre)

       Date: Mon, 11 Jul 88 22:27 EDT
       From: barmar@Think.COM (Barry Margolin)

	   Date: Mon, 11 Jul 88 13:34 EDT
	   From: cjl@wheaties.ai.mit.edu (Chris Lindblad)

	   What I do is use warn instead of error, and have the macro expand to something
	   safe, like nil.

       NIL isn't safe.  Expand into (PROGN) or (VALUES) instead.  If the form
       is in the body of a TAGBODY (or anything with an implicit tag body, such
       as DO or PROG), NIL is treated as a tag, not a form, and if you have
       multiple of them you will get a warning about duplicate tags.

   Sorry.  I was unaware that the body of a LET was an implicit tagbody.

The body of a LET is not an implicit tagbody.  But who says that
macros are only used in the bodies of LET?  Consider

(tagbody
  foo ...
      (my-macro ...)
      ...
      (my-macro ...)
      (go foo))

If MY-MACRO expands into NIL, you get

(tagbody
  foo ...
  nil ...
  nil (go foo))

which has duplicate NIL tags.