[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
compiler-let and macrolet in macros
Consider the following hack.
(defmacro with-car (&body body)
`(compiler-let((operator 'car))
,. body))
(defmacro with-cdr (&body body)
`(compiler-let((operator 'cdr))
,. body)
(defmacro right-side (exp) `(,operator ,exp))
What I want to know is will the following work
(setf (with-car (right-side foo)) (with-cdr (right-side goo)))
Probably not. Of course this can be transformed into
(with-car (setf (right-side foo) (with-cdr (right-side goo))))
However, I think the latter is more obscure. By the way, I don't believe
that an implementation of this sort using macrolet will work either.
The point of all of this is that macroexpand does not expand either
compiler-let or macrolet. Thus, setf can't see its real arguments. There
is a solution to this kind of problem but it would require much more
sophisticated macro expansion than is done today or has been proposed.
Before, I endeavor to write up a proposal for better macro expansion
facilities, I want to know if anybody is interested in either the problem or
its solution.
Jeff