Object id, hash, etc?

joe joeedh at gmail.com
Tue Sep 8 18:16:51 UTC 2015

Didn't send to list, something is wrong with my reply all. Sorry about
that. Stupid mobile gmail.
---------- Forwarded message ----------
From: "joe" <joeedh at gmail.com>
Date: Sep 8, 2015 11:15 AM
Subject: Re: Object id, hash, etc?
To: "Garrett Smith" <dhtmlkitchen at gmail.com>

I agree with this request. This is the logical complement to valueof, I
think. And yes, for most ID use cases this isn't a good fit, but we're not
talking about the general case, just the cases where a python style id()
function *is* appropriate.

On Sep 8, 2015 9:08 AM, "Garrett Smith" <dhtmlkitchen at gmail.com> wrote:

> On 9/8/15, Michael McGlothlin <mike.mcglothlin at gmail.com> 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).
> >
> >
> NFE's are safe to use where IE8 support isn't needed*.
> (function aa(){}).name; // "aa"
> As for using Object IDs and Object Pooling, lexically-scoped values
> have benefits over global ID generators (as your counter). The values
> can be passed in as a parameter to the Factory (useful with Private
> Proxy). There other benefits to this pattern regarding memory
> management and application design. Contact me if you'd like to learn
> more.
> * https://kangax.github.io/nfe/
> --
> Garrett
> @xkit
> ChordCycles.wordpress.com
> garretts.github.io
> personx.tumblr.com
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150908/d809eaa0/attachment.html>

More information about the es-discuss mailing list