[squeak-dev] How to become immediate objects? :-)

Marcel Taeumel marcel.taeumel at hpi.de
Wed Apr 15 09:55:47 UTC 2020


Hi all!

Thank you all for the clarification. Yes, please let's not copy the identity hash by default.

+1 on changing the default behind #becomeForward:

Best,
Marcel
Am 15.04.2020 09:59:09 schrieb Levente Uzonyi <leves at caesar.elte.hu>:
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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200415/8a9e5c5b/attachment.html>


More information about the Squeak-dev mailing list