[[OwnPropertyKeys]] key ordering

Allen Wirfs-Brock allen at wirfs-brock.com
Tue Apr 22 07:52:17 PDT 2014


On Apr 22, 2014, at 12:02 AM, Andreas Rossberg wrote:

> On 19 April 2014 20:14, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
>> 
>> The ordering I propose is:
>> 1) All array index property keys, in ascending array index numeric order. Followed by:
>> 2) All other string property keys, in property creation order. Followed by:
>> 3) All symbol property keys, in property creation order
> 
> Creation order? I don't know about other VM's, but for V8 it's
> unlikely that we are willing to pay the price for tracking that
> accurately.

My recollection of the last time we surveyed this was that all major engines did for-in enumeration of non-array index own property keys in creations/insertion order.  Has something changed for V8 in this regard?  My understanding is that the web depends upon that ordering for such properties.

An alternative would be to specify a sort ordering for string keyed properties.  That might be possible because this is a new MOP level operation.  However, some of the uses of it within the ES6 standard, such as Object.keys, require that they produce the same ordering as for-in.  Also, there is no natural sort ordering for Symbols

Allen



More information about the es-discuss mailing list