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

How to write macro within macro



Well, Kent and I both made the same mistake in our versions with nested
backquotes (Kent's second version, without the nesting, doesn't make this
mistake).  The expansion of both of our FOO macros doesn't pass the
arguments through:

(foo var 1 2 3) ==> (SETQ VAR (MAKE-FOO :A A :B B :C C))
rather than
		==> (SETQ VAR (MAKE-FOO :A 1 :B 2 :C 3))

The problem is that the FOO macro is missing commas before the references
to the parameters.

I remember running into this problem a couple of years ago, but I don't
remember how to get around it.  The problem is that the comma-quote-comma
(or, in Kent's case, comma-atsign-quote-comma) is used before the looping
form, and there's no way to get back inside the backquote in order to put a
single comma before the variables.  I'm not sure there's a way to do this
using nested backquotes.

By the way, there is a different, minor error in Kent's second version.
The LIST* should be LIST (the ",@" takes care of splicing into the list
properly).

						barmar