[whatwg] [URL] DOM API Feedback

Boris Zbarsky bzbarsky at MIT.EDU
Mon Nov 19 05:38:49 PST 2012


On 11/19/12 2:36 AM, David Bruant wrote:
> An ES6 proxy could do the trick here.

But then it's not a Map at all, right?  It's a proxy for maybe a Map, 
maybe something else.  In what sense would it be a Map at that point?

>> I suppose the same goes for ES6 Map.
> As Tab suggested, a Map subclass could certainly work

How close are "subclasses" to not being vaporware (both in spec and 
implementation terms)?  Speccing things in terms of vaporware makes them 
pretty hard to implement in actual implementations...  Doesn't mean we 
shouldn't do it, but I'm a bit wary of it, in general.

> The ordered part for objects wasn't true in ES5 (implementation specific
> order), but is considered for ES6 [1] since all web engines do the same
> order

Except they don't.  Here's a trivial example:

   var obj = {};
   obj["2"] = 5;
   obj["1"] = 0;

which is handled differently by different UAs.  The "same order" bit is 
only true for property names that don't look like array indices.  Per 
proposed spec you linked to, by the way, this will enumerate properties 
in the order "1" followed by "2".

Of course nothing really stops pages from using url parameters whose 
names look like array indices.  So if we want ordered here, we just 
can't use a object to do it.

-Boris



More information about the whatwg mailing list