Local functions and get-setf-expansion
Consider this bit of code (from CLHS with a few corrections):
(defmacro xpop (place &environment env) (multiple-value-bind (dummies vals new setter getter) (get-setf-expansion place env) `(let* (,@(mapcar #'list dummies vals) (,(car new) ,getter)) (if ,(cdr new) (error "Can't expand this.")) (prog1 (car ,(car new)) (setq ,(car new) (cdr ,(car new))) ,setter)))) (defsetf frob (x) (value) `(setf (car ,x) ,value)) (let ((z (list 1 2))) (flet ((frob (x) (cdr x))) (xpop (frob z))))
The CLHS says that that is invalid, but doesn't say why. I assume it's because
frob is shadowed by the
I think cmucl doesn't do this correctly because it doesn't look up the function name correctly.