Discussion Thread: DIP 1042--ProtoObject--Community Review Round 1

Elronnd elronnd at elronnd.net
Sat Jan 15 09:34:46 UTC 2022

On Saturday, 15 January 2022 at 08:33:45 UTC, Timon Gehr wrote:
> `pure` toHash can also be rather problematic in case it returns 
> the address of the object as an integer (as it currently does 
> by default). Pure code should not depend on GC memory addresses.

There has been a comment about that in object.d for over a 
decade; in that time, no one has made a compacting GC.  More 
practically, if somebody does write a compacting GC, it will be 
child's play for them to go and add a 'hash' field to Object and 
change the implementations of cmp and toHash.

(Obviously userspace code should not depend on such mechanisms, 
but for druntime, what is the problem?)

More information about the Digitalmars-d mailing list