[Vm-dev] Re: Reproducible way to crash Cog ( [Lsehub-staff] Strange behavior )

Andreas Raab andreas.raab at gmx.de
Wed Dec 8 22:14:45 UTC 2010


On 12/8/2010 1:58 PM, Igor Stasenko wrote:
> I never used this prim before, so i didn't knew that it takes the
> class of argument,
> instead an argument itself as a class to which replace receiver's class.

The primitive is an odd beast. I added it as a quick and dirty solution 
way back when I was trying to fix various issues around ClassBuilder. 
The reason it uses an instance instead of the class is that testing for 
compatibility between the receiver and argument is a simple format 
check, whereas when using the class you need to extract all sorts of 
assorted information (such as whether the argument is a compact class 
and the receiver is a compact class, if the number of instance slot 
matches, if it's an indexed object or not) that is not immediately 
accessible from a class.

I am amazed people actually use the primitive for something but let me 
say this loud and clear: This primitive is not intended to be used 
casually. In fact the comment states explicitly that:

	"The facility is really provided for certain, very specific 
applications (mostly related to classes changing shape) and not for 
casual use."

Cheers,
   - Andreas


More information about the Vm-dev mailing list