- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Mon, 9 Mar 2015 11:23:17 -0700
- To: "Mark S. Miller" <erights@google.com>
- Cc: David Dorwin <ddorwin@google.com>, public-script-coord <public-script-coord@w3.org>, Boris Zbarsky <bzbarsky@mit.edu>
On Mon, Mar 2, 2015 at 4:45 PM, Mark S. Miller <erights@google.com> wrote: > On Mon, Mar 2, 2015 at 3:08 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote: >> On Mon, Mar 2, 2015 at 2:28 PM, David Dorwin <ddorwin@google.com> wrote: > > [...] >> >> Given that this is backed by a Map, I don't think we can realistically >> do this until Maps gain the ability to specify a key comparator. > > The following code is untested, and was written only to play with an idea > provoked by this thread. It may also be besides the actual point of this > thread, but... [snip code] Yeah, it's not that difficult to design an object that exposes the Map interface and does key-comparing for you, but the important bit is that *that's not a Map*. Future extensions to Map, or user-extensions to the object, don't apply to it, Map.prototype.set doesn't work on it, etc. (This is one more instance of the general problem I've brought up a few times, that Map/Set aren't customizable in any way and it's really an issue. There should be an internal "SimpleMap" that just exposes the core methods needed, and which can be swapped out by users or specs for another object undetectably, so that Map/Set operate as an interface contract.) ~TJ
Received on Monday, 9 March 2015 18:24:04 UTC