Hi,
Here's a CLOS question for 'ya:
I need to define many methods that all use accessors to slots, and wish to use
the (with-slots (slot1 slot2 ...) instance {body}*) nomenclature to do so.
(this would prevent me from doing a with-slots for each function, and also
speed up the code accordingly (unless with-slots binds at compile-time...))
I've tried the following:
(defun setup ()
(with-slots
(slot1
slot2
...)
instance
(defmethod method1 ()
(...))
(defmethod method2 ()
(...))))
Is this a valid way to do things? I guess this is a form of closure, but the
compiler (Lucid) says:
SETUP has a non-empty lexical environment.
References to this environment will not be compiled correctly.
Do you wish to try compiling MAKE-VISUALISATION anyway? (Y or N):
When I compile it, it works. I think the reference to 'instance' is as-
sumed to be a global variable, hence the warning. As long as I wait till
'instance' is defined before I call 'setup', this should work, right?
Is there a more elegant way to do this? (I've thought of 'labels', but it's
not right in my situation)
Thanks!
Pierre Vachon Laboratoire de vision et systemes numeriques
······@gel.ulaval.ca Universite Laval, Quebec, CANADA.