{Spam?} Data conversion using #primitiveChangeClassTo: with GOODS

Avi Bryant avi.bryant at gmail.com
Sun Nov 28 10:40:36 UTC 2004


On Sun, 28 Nov 2004 18:35:49 +0800, Yar Hwee Boon <hboon at motionobj.com> wrote:
> I'm trying to convert some objects that is stored in GOODS to their
> subclass, but I'm not sure why its not working. Could anyone have a look?
> File in the attached and run the code below. How should I do this instead?
> Thanks.

Read the comment on #primitiveChangeClassTo:.   In particular, "Note:
The primitive will fail in most cases that you think might work. ".

If you really need to do this, #become: will work better (ie,
something like "a become: (BB basicNew copyFrom: a)"), though it's
slow if you use it on individual objects rather than with a bulk
#elementsExchangeIdentityWith:.

Avi



More information about the Squeak-dev mailing list