Lexical environment and compiler macro functions.
Mark Cox <[email protected]> Sun, 15 Mar 2015 16:16:36 +1000
| Newsgroups | gmane.lisp.cmucl.devel |
|---|---|
| Message-ID | <[email protected]> |
G'day,
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 (&whole form arg)
(declare (ignore arg))
form)
(defun test ()
(flet ((square (arg)
(declare (ignore arg))
(write "SQUARE!")))
(macrolet ((my-square (arg &environment env)
(if (compiler-macro-function 'square env)
`(function square)
nil)))
(my-square 1))))
(test)
=> #<Function (FLET SQUARE TEST) {48704B89}>
Thanks
Mark
_______________________________________________
cmucl-imp mailing list
[email protected]
http://lists.zs64.net/mailman/listinfo/cmucl-imp