On 3/10/2011 5:03 PM, Allen Wirfs-Brock wrote:
But those details are exactly the situations that break interoperability.

This behavior was perfectly consistent across all browsers until Chrome 6. I think it's more appropriate to say that Chrome is not interoperable with thousands of sites than to define interoperable behavior based on a minority browser's very very recent break from a de-facto standard that stood for 15 years.

Further, Chrome is used principally by developers and auto-updates itself. If Chrome behavior were reverted today, the number of browsers out there with this behavior would trend to zero in probably months.

But the sites and applications will last many years.  Just being practical here.

In https://mail.mozilla.org/pipermail/es-discuss/2010-December/012469.html I 
identified
scenarios where you can expect to get interoperable enumeration order among all 
major objects:

        The object has no inherited enumerable properties
        The object has no array indexed properties
        No properties have been deleted
        No property has had its attributes modified or been changed from a data 
property to an accessor property or visa versa

Quite correct, but because of your #2, this is worst-of-both options behavior:

---
3. It's good enough to preserve order for non-numeric keys only

This is an abysmal compromise, with the worst traits of each alternative.  It 
requires
browser vendors to implement order preservation, such that we don't get the 
minor
optimization that's possible from not preserving order at all.  At the same
time, it requires that applications and frameworks deal with lack of order for 
numeric
keys, which are very common: in the use case of mapping stored to displayed
values, stored values are very often numeric.
---

The distinction you make between Arrays and Objects isn't one that necessarily 
exist at the
implementation level.

Correct. You and I know that Objects and Arrays share most of their implementation. But don't you agree that, approaching the language as a beginner, it's a surprise that numeric indices behave differently from other indices *on Object*?

Are you suggesting that for all objects other than Array instances that
array indexed properties must enumerate in insertion order? Chrome isn't the 
only browser where
that currently isn't true.

No. I have no opinion on standardized iteration order on Array or on any object other than Object (Date, Regexp, et al). There never was any consistency there, and I have never seen a use case where it could conceivably be important that properties on eg a Regexp have a specific order. I think it would probably be best to leave these unstandardized, to give browser vendors maximum leeway to optimize.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to