From: ··············@yahoo.com
Subject: I'll take it that CMUCL PCL can't do ANSI class redefinition then?
Date: 
Message-ID: <761s5q$rd2$1@nnrp1.dejanews.com>
Well, all of you have been pretty silent about my question. I guess this is a
bug with CMUCL after all. From section 4.3.6 of the HyperSpec:

"When the class C is redefined, changes are propagated to its instances and to
instances of any of its subclasses. Updating such an instance occurs at an
implementation-dependent time, but no later than the next time a slot of that
instance is read or written."

When I access the slot in the example I gave after redefinition, I should get
"CLOS", not 0. I've played with many different examples, and I either get 0
or NIL. Is there some CMUCL extension function I can call to guarantee class
redifinition updates? GC'ing doesn't do the trick. I guess I could call EVAL
and manually update, but this can't be the right way.

When it comes time for me to ship an application, I'd like to use CMUCL if
possible, to save myself an arm and a leg in licensing and royalty fees, but
if it can't cut the mustard, I've got no choice.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

From: Barry Margolin
Subject: Re: I'll take it that CMUCL PCL can't do ANSI class redefinition then?
Date: 
Message-ID: <9ueh2.7$a06.2081@burlma1-snr1.gtei.net>
In article <············@nnrp1.dejanews.com>,
 <··············@yahoo.com> wrote:
>When I access the slot in the example I gave after redefinition, I should get
>"CLOS", not 0. I've played with many different examples, and I either get 0
>or NIL. Is there some CMUCL extension function I can call to guarantee class
>redifinition updates? GC'ing doesn't do the trick. I guess I could call EVAL
>and manually update, but this can't be the right way.

It could be a bug in the primary method for SHARED-INITIALIZE.  Have you
tried writing your own UPDATE-INSTANCE-FOR-REDEFINED-CLASS method, to
explicitly set the slot?

-- 
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Don't bother cc'ing followups to me.
From: Lieven Marchand
Subject: Re: I'll take it that CMUCL PCL can't do ANSI class redefinition then?
Date: 
Message-ID: <765jjk$3r3$2@xenon.inbe.net>
··············@yahoo.com writes:

> Well, all of you have been pretty silent about my question. I guess this is a
> bug with CMUCL after all. From section 4.3.6 of the HyperSpec:
> 
> "When the class C is redefined, changes are propagated to its instances and to
> instances of any of its subclasses. Updating such an instance occurs at an
> implementation-dependent time, but no later than the next time a slot of that
> instance is read or written."
> 

I agree. It seems like a bug.

> When I access the slot in the example I gave after redefinition, I should get
> "CLOS", not 0. I've played with many different examples, and I either get 0
> or NIL. Is there some CMUCL extension function I can call to guarantee class
> redifinition updates? GC'ing doesn't do the trick. I guess I could call EVAL
> and manually update, but this can't be the right way.

You can call the standard function MAKE-INSTANCES-OBSOLETE to force
the updates. However since this uses the same mechanism that has the
bug I suppose this will have the same problem. (I don't have CMUCL
handy at the moment to test) You can override the generic function
UPDATE-INSTANCE-FOR-REDEFINED-CLASS yourself.

-- 
Lieven Marchand <···@bewoner.dma.be> 
------------------------------------------------------------------------------
Few people have a talent for constructive laziness. -- Lazarus Long
From: Raymond Toy
Subject: Re: I'll take it that CMUCL PCL can't do ANSI class redefinition then?
Date: 
Message-ID: <4ng1a0z42h.fsf@rtp.ericsson.se>
>>>>> "robert" == robert m miles <··············@yahoo.com> writes:

    robert> When I access the slot in the example I gave after redefinition, I should get
    robert> "CLOS", not 0. I've played with many different examples, and I either get 0
    robert> or NIL. Is there some CMUCL extension function I can call to guarantee class
    robert> redifinition updates? GC'ing doesn't do the trick. I guess I could call EVAL
    robert> and manually update, but this can't be the right way.

I don't know what the problem is, but CMUCL does eventually update the 
object, as this example shows:

* (defclass programmer ()
	   ((name :initarg :name)
	    (salary :initarg :salary)
	    (favorite-language :initarg :favorite-language
			       :initform "Common Lisp")))
#<STANDARD-CLASS PROGRAMMER {718F2CD}>
* (setf robert (make-instance 'programmer))
Warning:  Declaring ROBERT special.

#<PROGRAMMER {71926DD}>
* (defclass programmer ()
	   ((name :initarg :name)
	    (salary :initarg :salary)
	    (favorite-language :initarg :favorite-language
			       :initform "Common Lisp")
	    (favorite-object-system :initarg :favorite-object-system
				    :initform "CLOS")))
#<STANDARD-CLASS PROGRAMMER {718F2CD}>
* robert
#<PROGRAMMER {71926DD}>
* (slot-value robert 'favorite-object-system)
"CLOS"
* 

So, accessing via slot-value doesn't update the class.  Doing anything 
else to robert seems to cause the update to happen.

Ray
From: Lieven Marchand
Subject: Re: I'll take it that CMUCL PCL can't do ANSI class redefinition then?
Date: 
Message-ID: <768jtb$28t$2@nickel.uunet.be>
··············@yahoo.com writes:

> Well, all of you have been pretty silent about my question. I guess this is a
> bug with CMUCL after all. From section 4.3.6 of the HyperSpec:
> 

I've been able to do some tests now. The
UPDATE-INSTANCE-FOR-REDEFINED-CLASS system default is correct but the
slot-value doesn't seem to trigger it. It seems like some kind of
caching problem. When after the redefinition you do a describe the
update gets done.

Starting /usr/local/cmucl/bin/cmucl ...
; Loading #p"/home/mal/.cmucl-init".
CMU Common Lisp 18b, running on cassatie
Send questions and bug reports to Lieven Marchand, or to ··········@cons.org. and ·········@cons.org. respectively.
Loaded subsystems:
    Python 1.0, target SPARCstation/Solaris 2
    CLOS based on PCL version:  September 16 92 PCL (f)
* 
* (defclass foo () ((x :initform 'foo)))
#<STANDARD-CLASS FOO {70F86F5}>
* (setf *foo* (make-instance 'foo))
Warning:  Declaring *FOO* special.

#<FOO {70FB89D}>
* (defclass foo () ((x :initform 'newfoo) (y :initform 'bar)))
#<STANDARD-CLASS FOO {70F86F5}>
* (slot-value *foo* 'x)
FOO
* (slot-value *foo* 'y)
0
* (describe *foo*)

#<FOO {70FB89D}> is an instance of class #<Standard-Class FOO {70F3D7D}>:
 The following slots have :INSTANCE allocation:
 Y    BAR
 X    FOO
* (slot-value *foo* 'y)
BAR
* 

-- 
Lieven Marchand <···@bewoner.dma.be> 
------------------------------------------------------------------------------
Few people have a talent for constructive laziness. -- Lazarus Long