iteration order for Object

Brendan Eich brendan at mozilla.com
Sat Mar 12 00:02:07 PST 2011


On Mar 11, 2011, at 12:11 PM, Charles Kendrick wrote:

> And again, I find your notion that an Object is "obviously" a HashMap very suspect.

John's simply mistaken :-).

Take it from me, JS objects are not hashmaps and any would-be implementor who tries that and tests on real code is quickly disabused of the notion. It's not going to change, for named properties or any kind of property name.

The fact that many optimizing VMs bend the rules for array elements, if not for all indexed properties, suggests but of course does not prove that insertion order is a de-facto requirement for non-indexed "own" properties.

More on this when I've caught up on the thread, but I wanted to back your contention, not merely that it's not obvious that JS objects are hashmaps, but that they are not any such simple thing. True fact!

/be


More information about the es-discuss mailing list