[squeak-dev] Object new becomeForward: #normal

Bert Freudenberg bert at freudenbergs.de
Tue Jul 18 21:10:16 UTC 2017


On Tue, Jul 18, 2017 at 10:03 PM, Eliot Miranda <eliot.miranda at gmail.com>
wrote:

>
> I'm modifying the Spur VM to fail becomeForward: when copyHash is true and
> the target object is immutable.  So when we have immutable literals,
> #normal would be immutable and the become would fail.
>

​+1​


> However, it seems to me that becomerForward: doing a copyHash is itself a
> bug.  What's the rationale for copying the receiver's hash to the target
> object?  I've seen various frameworks use become to clean-up objects by
> doing aNoLongerWantedObject becomeFor4ward: nil, and with our current
> default implementation for becomeForward: that will cause havoc.
>

​Well, it would mean nil's identityHash changes. But since nil isn't
typically used as key in hashed collections, that use may be fine?

I agree that the becomeForward: default should be to not copy the hash.
This could be done in the image though, no need to change the primitive.

​- Bert -​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20170718/d4a0d4f8/attachment.html>


More information about the Squeak-dev mailing list