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

Marcel Taeumel marcel.taeumel at hpi.de
Wed Apr 15 12:29:58 UTC 2020


Hi Jakob,

collections use #hash, which can be different for different objects. So rehashing is important after #becomeForward: in any case.

Best,
Marcel
Am 15.04.2020 13:18:59 schrieb Jakob Reschke <forums.jakob at resfarm.de>:
Hi,

The reason I read somewhere for the copyHash true default is that one would have to rehash collections that contain the involved objects if the hash did change.

Anything to be done in this regard of you change the default?

Kind regards,
Jakob 

Marcel Taeumel <marcel.taeumel at hpi.de [mailto:marcel.taeumel at hpi.de]> schrieb am Mi., 15. Apr. 2020, 11:56:

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 [mailto: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/acdc570e/attachment.html>


More information about the Squeak-dev mailing list