On Sat, Jul 9, 2011 at 3:48 AM, Andreas Rossberg <[email protected]> wrote: > >> We went back and forth on this. I believe the rationale is in the wiki (but >> perhaps in one of the strawman:*name* pages). There are a couple of reasons: >> 1. We want private name objects to be usable as keys in WeakMaps. Clearly we >> could extend WeakMaps to have either "object" (but not "null") or "name" >> typeof-type keys, but that complexity is not warranted yet. > > I can see that being a relevant use case for weak maps. But the same > logic applies to using, say, strings or numbers as keys. So isn't the > right fix rather to allow weak maps to be keyed on any JS value?
Unlike Names, strings and numbers are forgeable, so if they were allowed as keys in WeakMaps, the associated value could never be safely collected. Names, by contrast, have identity. -- sam th [email protected] _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

