[squeak-dev] Object new becomeForward: #normal
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>
> 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.
> 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...
More information about the Squeak-dev