[squeak-dev] How to become immediate objects? :-)
Levente Uzonyi
leves at caesar.elte.hu
Wed Apr 15 07:58:58 UTC 2020
Hi Chris,
On Tue, 14 Apr 2020, Chris Muller wrote:
> Hi Eliot,
>
>
> Right. A couple of questions are
> 1. what the f**k are become: becomeForward: becomeForward:copyHash: et al doing in ProtoObject? (IMO, they should be in Object and have no business being in ProtoObject whatsoever).
>
>
> For Proxy's. They don't typically inherit from Object, but must be able to become their normal object upon receiving a message it #doesNotUnderstand:. Maybe you're implying those programs should be using the mirror
> primitives, but those weren't always available, so hopefully that at least answers your question.
The primitives are defined on arrays. A proxy can and should always do
{ self } elementsForwardIdentityTo: { proxiedObject }
So, that's not a reason to have those methods implemented by ProtoObject.
>
> 2. whether becomeForward: should do copyHash: true by default. This seems wrong to me, and implementing is as copyHash: false makes more sense. But I'm wondering if there are important use cases.
>
>
> Yes, changing the identityHash without changing the identity is basically "wrong", and even dangerous if it's a system Symbol used as keys in IdentityDictionary's like Environments, etc.
>
> Object new becomeForward: #size "do it = lock up your image"
The VM won't let you overwrite the Symbol's identityHash in current
Trunk, you'll get an error instead.
Levente
>
> - Chris
>
>
More information about the Squeak-dev
mailing list
|