From: Tunc Simsek
Subject: [reinitialize-instance] CLOS MOP
Date: 
Message-ID: <39B9787A.72E17552@robotics.eecs.berkeley.edu>
Suppose I define:

(defclass foo ()
   ((x :initform nil)))

Then, I do:

(setf *my-foo* (make-instance 'foo))
(setf (slot-value *my-foo* 'x) t)

Then, I redefine:

(defclass foo ()
   ((y :initform nil)   
    (x :initform nil)))

I check *my-foo*:

(describe *my-foo*)

===>

#<FOO @ #x485e32a> is an instance of #<STANDARD-CLASS FOO>:
 The following slots have :INSTANCE allocation:
  Y   NIL
  X   T

The question then, is, how did the reinitialization procedure
know to keep the value T for slot X?  It seems to me that
by the time REINITIALIZE-INSTANCE is called on *MY-FOO*,
previous history of slot definitions is not known.

Thanks,
Tunc
From: Rainer Joswig
Subject: Re: [reinitialize-instance] CLOS MOP
Date: 
Message-ID: <joswig-77DA09.02000609092000@news.is-europe.net>
In article <·················@robotics.eecs.berkeley.edu>, 
······@robotics.eecs.berkeley.edu wrote:

> The question then, is, how did the reinitialization procedure
> know to keep the value T for slot X?  It seems to me that
> by the time REINITIALIZE-INSTANCE is called on *MY-FOO*,
> previous history of slot definitions is not known.

There is no history of slot definitions by default.
There is only the current value and this is retained
for slots that are not changing through class redefinitions.

http://www.xanalys.com/software_tools/reference/HyperSpec/Body/sec_4-3-6-1.html

  4.3.6.1 Modifying the Structure of Instances
  ...
  The values of local slots specified by both the new and old
  classes are retained

-- 
Rainer Joswig, Hamburg, Germany
Email: ·············@corporate-world.lisp.de
Web: http://corporate-world.lisp.de/