Shadowing compiler macro functions.
CMUCL does not shadow the compiler macro function present in the global environment when introducing a function with the same name in the current lexical environment.
This is demonstrated with the following example:
(defun square (x)
(expt x 2))
(define-compiler-macro square (x)
`(expt ,x 2))
(defmacro with-square-check (&body body &environment env)
(let ((text (if (compiler-macro-function 'square env)
"Yes"
"No")))
(progn
(format t "SQUARE compiler macro present: ~A.~%" ,text)
,@body)))
(defun test/absent ()
(with-square-check
(square 2)))
(defun test/present ()
(flet ((square (x)
(print (expt x 2))))
(with-square-check
(square 2))))
CL-USER> (test/absent)
SQUARE compiler macro present: Yes.
=> 4
CL-USER> (test/present)
SQUARE compiler macro present: Yes.
4
=> 4
Thanks Mark