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

MACROEXPANDED not working with SETF



; I suppose you know about this already, but here it is
; anway.

(setq x '(nil nil))
(NIL NIL) 

(defmacro foo (m) `(car ,m))
FOO 

(defun c-b (l v) (setf (foo l) v))
C-B 

(c-b x 9)
11 

x 
(11 NIL) 

(defmacro foo (m) `(cadr ,m))
FOO 

(c-b x 99)
121 

x 
(121 NIL) 

; It is evident from the SETF MACROEXPANDED form that it doesn't
; remember the "versions" of all the macros it had to forcebly
; expand in order to do its own expansion.

; Might as well not bother with the MACROMEMO scheme and just have
; all macros displace if it isn't going to work in the one of
; the most common cases, SETF.

; By the way, I think its a win that SETF is a macro anyway.

-gjc