[comp.lang.clos] Making instances obsolete

nayak@Neon.Stanford.EDU (Pandurang Nayak) (05/03/91)

I have a question about MAKE-INSTANCES-OBSOLETE and
UPDATE-INSTANCE-FOR-REDEFINED-CLASS.  I would like to make the
instances of a class obsolete, without having to redefine the class.
A call to MAKE-INSTANCES-OBSOLETE leads to the following behavior for 
UPDATE-INSTANCE-FOR-REDEFINED-CLASS.  I was wondering whether it is a
bug, a feature, or merely unspecified (I'm running CLOS on a TI
Explorer). 

> (defclass foo-class nil ((b :initform nil) (a :initform nil)))
#<STANDARD-CLASS FOO-CLASS>
> (setq foo-instance (make-instance 'foo-class))
#<FOO-CLASS 26463632>
> (trace update-instance-for-redefined-class)
(UPDATE-INSTANCE-FOR-REDEFINED-CLASS)
> (make-instances-obsolete (find-class 'foo-class))
NIL
> (slot-value foo-instance 'a)
(1 ENTER UPDATE-INSTANCE-FOR-REDEFINED-CLASS: #<FOO-CLASS 26470422> NIL (B A) (B NIL A NIL))
(1 EXIT UPDATE-INSTANCE-FOR-REDEFINED-CLASS: NIL)
NIL

Here's the problem.  UPDATE-INSTANCE-FOR-REDEFINED-CLASS gets called
with (B A) being the discarded slots, when they haven't really been
discarded (since the slot value was accessed without any problem).

If this isn't a bug, but is instead a feature, how can I force CLOS to
call UPDATE-INSTANCE-FOR-REDEFINED-CLASS without having it pretend
that slots need to be updated?

Incidentally, merely redefining a class without changing its slot spec
doesn't make instances obsolete.  What does seem to work fine is if I
make instances obsolete and then redefine the class as follows:

> (make-instances-obsolete (find-class 'foo-class))
NIL
> (defclass foo-class nil ((b :initform nil) (a :initform nil)))
#<STANDARD-CLASS FOO-CLASS>
> (slot-value foo-instance 'a)
(1 ENTER UPDATE-INSTANCE-FOR-REDEFINED-CLASS: #<FOO-CLASS 26477546> NIL NIL NIL)
(1 EXIT UPDATE-INSTANCE-FOR-REDEFINED-CLASS: NIL)
NIL

Is this the recommended way to achieve what I want?

Thanks for any help.

Pandu