From: Bruce Lester
Subject: closure/defmethod question
Date: 
Message-ID: <5%9o8.118546$af7.62739@rwcrnsc53>
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?
From: Rahul Jain
Subject: Re: closure/defmethod question
Date: 
Message-ID: <874rj23dx7.fsf@photino.sid.rice.edu>
"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.