Object id, hash, etc?

Michael McGlothlin mike.mcglothlin at gmail.com
Wed Sep 9 17:45:30 UTC 2015


I'm only seeing a couple comments there - was that all or am I missing something?

I think hashes as an overwritable method that returns a number is pretty standard and let's you combine member hashes with simple Bitwise ops. Could have on value types and a default on Object that would combine hash of own props that were value types or frozen.

Thanks,
Michael McGlothlin
Sent from my iPhone

> On Sep 9, 2015, at 9:53 AM, Brendan Eich <brendan at mozilla.org> wrote:
> 
> For posterity:
> 
> http://wiki.ecmascript.org/doku.php?id=proposals:hashcodes
> http://wiki.ecmascript.org/doku.php?id=discussion:hashcodes
> 
> (from ES4 daze, a long time ago.)
> 
> /be
> 
> Michael McGlothlin wrote:
>> Is there a reason not to provide an object id and hash value as other languages often do? I find myself defining an identity symbol on objects with a value from a simple global counter. It makes it easier to debug if I can just look at a log and see what objects and functions were active.
>> 
>> Likewise a hash value would simplify a lot of comparisons and make it easier to debug.
>> 
>> I especially find the ID useful when working with bound functions as they can be difficult to tell apart. I like to change toString() to provide the ID followed by the code (flattened to one line).
>> 
>> 
>> Thanks,
>> Michael McGlothlin
>> Sent from my iPhone
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>> 


More information about the es-discuss mailing list