Clozure / ccl

Clozure Common Lisp
http://ccl.clozure.com
Apache License 2.0
841 stars 105 forks source link

SETF does not always respect symbol macros #448

Closed digikar99 closed 11 months ago

digikar99 commented 1 year ago

Especially when symbol macros are supplied through augment environment instead of being processed directly, SETF fails to respect them.

CL-USER> (let ((env (augment-environment 
                     nil
                     :symbol-macro (list (list 'elt '(aref a 0))))))
           (macroexpand-1 'elt env))
(AREF A 0)
T
CL-USER> (let ((env (augment-environment 
                     nil
                     :symbol-macro (list (list 'elt '(aref a 0))))))
           (macroexpand-1 '(setf elt 1) env))
(SETQ ELT 1)
T

The following works though:

CL-USER> (let ((a (make-array 10)))
           (symbol-macrolet ((elt (aref a 0)))
             (setf elt 1))
           a)
#(1 0 0 0 0 0 0 0 0 0)