Re: SLOT-VALUE bug?
On 25 Dec 2006, at 18:31, Edi Weitz wrote:
>
> [LWW 5.0.1]
>
> If I compile and load the code at the end of this email, I get this:
>
> CL-USER 1 > (quux (make-instance 'a))
> BAR
>
> My gut feeling tells me that this is a bug in SLOT-VALUE and I'm
> seeing some kind of optimization which doesn't work. But maybe I'm
> wrong and what I'm doing is against the (ANSI) law. Any thoughts?
Yes, you committing crimes against the laws of ANSI. ;)
See the notes section about change-class: "The generic function
change-class has several semantic difficulties. First, it performs a
destructive operation that can be invoked within a method on an
instance that was used to select that method. When multiple methods
are involved because methods are being combined, the methods
currently executing or about to be executed may no longer be
applicable. Second, some implementations might use compiler
optimizations of slot access, and when the class of an instance is
changed the assumptions the compiler made might be violated. This
implies that a programmer must not use change-class inside a method
if any methods for that generic function access any slots, or the
results are undefined."
Some think that this wording is still too optimistic... :}
Pascal
--
Pascal Costanza, mailto:pc@p-cos.net, http://p-cos.net
Vrije Universiteit Brussel, Programming Technology Lab
Pleinlaan 2, B-1050 Brussel, Belgium