On Mon, Feb 13, 2012 at 10:59 PM, Allen Wirfs-Brock
<al...@wirfs-brock.com> wrote:
> I would normally agree with you.  ECMAScript for-in property enumeration 
> order is defined in exactly that manner.  However, the experience with 
> JavaScript in browsers is that there is a significant amount of code that has 
> been developed that depends upon a particular enumeration order that is 
> widely used in browsers.  People write code with dependencies (often 
> unintentional) upon the enumeration order used by their favorite browser.  If 
> their code breaks when it is run on other browsers, they complain.  Over 
> time, this is a force that push browsers with less market share to match the 
> implementation decisions of browser with more market share.  This happened 
> with for-in enumeration and I expect it will happen with Set/Map iteration 
> order if we leave it unspecified.

That is too pessimistic. With for-in enumeration, the initial
implementations chose insertion order, which was (a) not arbitrary,
(b) easy for users to observe and understand, and (c) consistent
across browsers.

Unless TC39 specifies otherwise, the enumeration order of Map and Set
will be arbitrary, it will certainly be inconsistent across browsers,
and it will most likely even include a random component per Map/Set
object.

It is very hard to see how any code could depend on a particular
implementation's enumeration order if it is randomized.

-j
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to