I'm not sure I understand the reasonning here. Introducing a new feature to shim another new feature? What about implementators just implement the initial new feature?
In other words: would hash be of any use if Set, Map and WeakMaps (why not WeakSets?) were deployed? Set/Map/WeakMap are already being implemented in Firefox and Chrome. At this pace, hashes will be implemented only in browsers that don't need these to be shimed. Is there another use case for exposing hashes? David Le 30/03/2012 20:16, Brendan Eich a écrit : > Good point, IIRC dherman and markm have discussed basing sets and maps > on delegated hash and equals, so it's not all object identity. As you > point out, this helps the shim builders. > > /be > > Kris Kowal wrote: >> I think it is fair, for the shimming crowd, to ask objects to >> implement a `hash` method to return a consistent string. Collection >> types can degrade to O(n) in the absence of a provided consistent >> hash, but enhance to O(1) in the best case. This would involve having >> a two layer internal datastructure, an object that maps consistent >> hashes -> to array buckets -> to values for Set or [key, value] pairs >> for Map. I would also implement Map in terms of Set, just overriding >> the hash and equals functions to operate on the key portion of each >> pair in the set. >> >> Kris Kowal >> _______________________________________________ >> es-discuss mailing list >> [email protected] >> https://mail.mozilla.org/listinfo/es-discuss >> > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

