Do the Common Lisp rules regarding closures and functions (defun) apply to
CLOS structures created with defmethod and defclass?
The following code behaves as I expect (the value of A is available to
closure-test) in LispWorks:
(let ((a 5))
(defmethod closure-test ((i integer))
(format t "I:~A A:~A~%" i a)))
Is this behavior a core part of Common Lisp that would work in other Common
Lisp implementations?
"Bruce Lester" <············@email.com> writes:
> Do the Common Lisp rules regarding closures and functions (defun) apply to
> CLOS structures created with defmethod and defclass?
According to _The Art of the Metaobject Protocol_, the :initform args
close over the environment of the defclass form. I assume that this is
a requirement also present in the ANSI CL standard.
--
-> -/ - Rahul Jain - \- <-
-> -\ http://linux.rice.edu/~rahul -=- ············@techie.com /- <-
-> -/ "Structure is nothing if it is all you got. Skeletons spook \- <-
-> -\ people if [they] try to walk around on their own. I really /- <-
-> -/ wonder why XML does not." -- Erik Naggum, comp.lang.lisp \- <-
|--|--------|--------------|----|-------------|------|---------|-----|-|
(c)1996-2002, All rights reserved. Disclaimer available upon request.