[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Code Generated by Macros
- To: greek@DEC-HUDSON.ARPA, common-lisp@SU-AI.ARPA
- Subject: Code Generated by Macros
- From: David C. Plummer in disguise <DCP@SCRC-QUABBIN.ARPA>
- Date: Wed, 24 Apr 85 15:07 EST
- In-reply-to: The message of 24 Apr 85 09:54-EST from greek at DEC-HUDSON
- References: The message of 24 Apr 85 09:54-EST from greek at DEC-HUDSON, <WHOLEY.12105729067.BABYL@CMU-CS-C.ARPA>
Date: Wed, 24 Apr 85 09:54:41 EST
Did anyone out there write any of the Common LISP macro definitions
so that they generate DO, DOTIME, DOLIST or the like? Oops.
If the programmer uses a macro inside a construct that establishes
a block named NIL, and then does a RETURN from inside the macro,
there had better not be any blocks named NIL generated by the macro,
or the RETURN will return to the wrong place.
Not an obvious problem, and we blew it. Or maybe the idea of a block
named NIL is bogus.
I know what you are talking about, but I can't come up with an example
that can't be programmed around. For example,
(defmacro dotimes-named (name (var form) &body body)
(dotimes (,var ,form)
It isn't pretty, but it does work. I don't know if there are easier ways
to do this particular things. I have seen easier ways to other similar
Perhaps it is for reasons like this that Lisp Machine Lisp has DO-NAMED?
That is, perhaps DO-NAMED is the prefered thing to expand into instead
of DO, since it won't accidentally steal the block named NIL?
Another way out is to document your macros as "having an implicit block