[Vm-dev] Re: Reproducible way to crash Cog ( [Lsehub-staff]
Strange behavior )
Igor Stasenko
siguctua at gmail.com
Wed Dec 8 22:24:26 UTC 2010
On 8 December 2010 23:14, Andreas Raab <andreas.raab at gmx.de> wrote:
>
> 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."
yes, Benjamin actually could avoid using it by copying a metaclass first,
and then doing
meta basicNew
and use the result as a 'copy' of class, and then copy only necessary
ivars from old class to this one.
>
> Cheers,
> - Andreas
>
--
Best regards,
Igor Stasenko AKA sig.
More information about the Vm-dev
mailing list