iteration order for Object

Allen Wirfs-Brock allen at wirfs-brock.com
Sat Mar 12 12:24:24 PST 2011


On Mar 12, 2011, at 11:58 AM, David Bruant wrote:

> Le 12/03/2011 19:41, Brendan Eich a écrit :
>> 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.
> I fully agree. I don't have myself a decent use case for that. My point
> was just that if we standardize the order as in the strawman, we will
> have lost forever the possibility to retrieve overall property order...

No you haven't.  There is nothing stopping somebody in the future from proposing:
     Object.keyInCreationOrder(obj)

Whether you will be able to convince anyone to accept and implement such a proposal proposal is different matter.

> I also would like to remind that the for..in enumeration order is used
> in different places (for instance the Object.defineProperties methods,
> which also means Object.create (second argument))...

That's a good point.  I'm not sure it is a significant issue but it is one that should be considered.

Allen


More information about the es-discuss mailing list