On Mar 12, 2011, at 10:41 AM, Brendan Eich <[email protected]> wrote:

> On Mar 12, 2011, at 9:54 AM, David Bruant wrote:
> 
>> The little "issue" I see in returning 1) index properties in ascending
>> order 2) all other properties in addition order is that there is a bit
>> of information lost in the process: overall property addition order
>> (index properties included).
> 
> This is an issue in theory. Beware _a priori_ reasoning about usability 
> issues.
> 
> In practice both users and (especially) implementors Do Not Want indexed 
> properties enumerated in insertion order. The proof is the use of for-in over 
> arrays, still common enough, also advised against (but that is like talking 
> back to the tide).

I don't understand why this is still being discussed as a single behavior 
across Array and Object.

If we define the iteration order as:

1. Object: in-order including indices
2. Array: indices first

Then:

1. There's no information loss going from Object literal to live Object
2. Array has the for..in behavior people expect
3. Object has a useful behavior (similar to Java LinkedHashMap) instead of a 
surprising behavior (treating indices specially)

This is aside from the performance and backcompat benefits covered previously.

You mentioned JS conflates Arrays and Objects - so - let's stop doing that :)
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to