🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.clos
Article #530

Making instances obsolete

#530
From: Pandurang Nayak
Date: Fri, 03 May 1991 04:17
48 lines
2453 bytes
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
Technical Details
Message-ID: <1991May3.041716.13277@neon.Stanford.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!uunet!stanford.edu!neon.Stanford.EDU!nayak

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!uunet!stanford.edu!neon.Stanford.EDU!nayak
From: nayak@Neon.Stanford.EDU (Pandurang Nayak)
Newsgroups: comp.lang.clos
Subject: Making instances obsolete
Message-ID: <1991May3.041716.13277@neon.Stanford.EDU>
Date: 3 May 91 04:17:16 GMT
Article-I.D.: neon.1991May3.041716.13277
Sender: nayak@neon.Stanford.EDU (Pandurang Nayak)
Distribution: usa
Organization: Computer Science Department, Stanford University, Ca , USA
Lines: 48