[squeak-dev] Changing an object's class

Chris Muller asqueaker at gmail.com
Mon May 2 01:18:32 UTC 2011


Ah, I never saw #adoptInstance: before, thanks.

On Sun, May 1, 2011 at 7:04 PM, Levente Uzonyi <leves at elte.hu> wrote:
> On Sun, 1 May 2011, Chris Muller wrote:
>
>>> So I thought, well, wouldn't it be nice if one could _change the class_
>>> of
>>> the MutableZTrees so they all magically turn into nice immutable ZTrees.
>>
>> Object>>#primitiveChangeClassTo:
>>
>>
>
> It doesn't work in cases like:
>
> #[65 66 67] primitiveChangeClassTo: ByteString. "==> primitiveFailed"
>
> | b |
> b := #[65 66 67].
> ByteString adoptInstance: b.
> b "==> 'ABC'"
>
> And it's probably broken too:
>
> Object new primitiveChangeClassTo: ProtoObject. "==> primitiveFailed"
>
>
> Levente
>
>



More information about the Squeak-dev mailing list