From: jimka
Subject: FIND-CLASS inside UPDATE-INSTANCE-FOR-REDEFINED-CLASS
Date: 
Message-ID: <3e04e048-7d5b-4de2-8bdc-8531f3a67821@b2g2000prf.googlegroups.com>
Does anyone know whether the behavior of UPDATE-INSTANCE-FOR-REDEFINED-
CLASS is
specified with respect to FIND-CLASS?  I.e., it seems like during the
time a class
is begin redefined and instances are being updated (either greedily or
lazily) that for some
period of time there are two classes allocated:  an old one and a new
one.

What is FIND-CLASS supposed to do during this time?   Is the return
value of FIND-CLASS
specified if called inside UPDATE-INSTANCE-FOR-REDEFINED-CLASS?

My guess would be that FIND-CLASS needs to always return the "new"
version of the class,
and also a valid, completely initialized version.

-jim

From: Pascal Costanza
Subject: Re: FIND-CLASS inside UPDATE-INSTANCE-FOR-REDEFINED-CLASS
Date: 
Message-ID: <6kud7jF9iklmU1@mid.individual.net>
jimka wrote:
> Does anyone know whether the behavior of UPDATE-INSTANCE-FOR-REDEFINED-
> CLASS is
> specified with respect to FIND-CLASS?  I.e., it seems like during the
> time a class
> is begin redefined and instances are being updated (either greedily or
> lazily) that for some
> period of time there are two classes allocated:  an old one and a new
> one.
> 
> What is FIND-CLASS supposed to do during this time?   Is the return
> value of FIND-CLASS
> specified if called inside UPDATE-INSTANCE-FOR-REDEFINED-CLASS?
> 
> My guess would be that FIND-CLASS needs to always return the "new"
> version of the class,
> and also a valid, completely initialized version.

Yes, that's correct.

See 4.3.6 in the HyperSpec: "Redefining a class modifies the existing 
class object to reflect the new class definition; it does not create a 
new class object for the class."

There may be a class metaobject representing the old version of a class, 
but the above passage implies that it must be a different object.


Pascal

-- 
Lisp50: http://www.lisp50.org

My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: jimka
Subject: Re: FIND-CLASS inside UPDATE-INSTANCE-FOR-REDEFINED-CLASS
Date: 
Message-ID: <88057653-0042-4838-b26e-b550d5ea53a9@g17g2000prg.googlegroups.com>
yes, the identity of the class is the same before and after the
redefinition.  but
at the time update-instance-for-redefined-class is called, i would
expect that
find-class return the NEW version.  I.e., the class has already been
updated
by the tem UIFRC is called.  And that this be true whether or not the
implementation
lazily or greedily updates the instances.

Do you know whether this is so obvious that noone would ever think
different?
Or is it specified to work as such?

-jim
From: Pascal Costanza
Subject: Re: FIND-CLASS inside UPDATE-INSTANCE-FOR-REDEFINED-CLASS
Date: 
Message-ID: <6kulrqF9ovtsU1@mid.individual.net>
jimka wrote:
> yes, the identity of the class is the same before and after the
> redefinition.  but
> at the time update-instance-for-redefined-class is called, i would
> expect that
> find-class return the NEW version.  I.e., the class has already been
> updated
> by the tem UIFRC is called.  And that this be true whether or not the
> implementation
> lazily or greedily updates the instances.
> 
> Do you know whether this is so obvious that noone would ever think
> different?
> Or is it specified to work as such?

I think it's specified, although not as explicitly as one could wish.

Section 4.3.6.1 states that the structure of instances is modified to 
conform to the new class definition. Section 4.3.6.2 states that this 
happens before update-instance-for-redefined-class is called.

The entry for update-instance-for-redefined-class states the following: 
"When make-instances-obsolete is invoked or when a class has been 
redefined and an instance is being updated, a property-list is created 
that captures the slot names and values of all the discarded-slots with 
values in the original instance. The structure of the instance is 
transformed so that it conforms to the current class definition. The 
arguments to update-instance-for-redefined-class are this transformed 
instance, a list of added-slots to the instance, a list discarded-slots 
from the instance, and the property-list containing the slot names and 
values for slots that were discarded and had values. Included in this 
list of discarded slots are slots that were local in the old class and 
are shared in the new class."

The important bit here is that the modification of the instance 
structure refers to the _current_ class definition. That step 
corresponds with the step in 4.3.6.1, so in other words, the new class 
definition is already the new one before 
update-instance-for-redefined-class is called.


Pascal


-- 
Lisp50: http://www.lisp50.org

My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/