[squeak-dev] Changing an object's class

Levente Uzonyi leves at elte.hu
Mon May 2 00:04:45 UTC 2011


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