[squeak-dev] Object new becomeForward: #normal
bert at freudenbergs.de
Tue Jul 18 14:24:39 UTC 2017
On Tue, Jul 18, 2017 at 1:33 PM, marcel.taeumel <Marcel.Taeumel at hpi.de>
> Hi, there.
> Why are there guards to prevent forward-becoming to immediates (chars,
> but not to symbols?
> This will break your image: "Object new becomeForward: #normal"
> ... because Cursor class MNU #normal ... :-) Either this is a bug or
> forward-becoming to symbols is not intended at all.
The unexpected behavior is that #becomeForward: actually *modifies* the
target object, because it tries to preserve the identity hash by copying it
from the source to the target object. If you don't copy the hash it
x := Object new.
x becomeForward: 42 copyHash: false.
y := Object new.
y becomeForward: #normal copyHash: false.
Arguably "copyHash: false" is a safer default, but then again, it would
break identity-hashed collections that have the source object as key.
- Bert -
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev