for-in evaluation order
Mark S. Miller
erights at google.com
Mon Dec 27 10:35:52 PST 2010
On Mon, Dec 27, 2010 at 9:54 AM, Wes Garland <wes at page.ca> wrote:
> I think Mark's suggestion here is very sensible. My gut tells me that it
> has a low probability of breaking the web, yet it offers room for
> implementers to provide a fast path for numeric object indices while
> offering an opportunity to codify standard practice.
I like Dave Herman's strawman at <
http://wiki.ecmascript.org/doku.php?id=strawman:enumeration>. It is a nice
simple deterministic spec that has the pleasant index-first property
mentioned above. It also plugs the other annoying source of non-determinism
-- what happens when insertions and/or deletions happen during enumeration
-- by mandating a snapshotting semantics. Together, I think this is a good
blend of efficiency, implementability, and programmer understandability.
Dave, under the spec for "Operation OwnProperties(obj)" step 1, you don't
explicitly state that these index properties are to be enumerated in numeric
order. An oversight? Also, you misstate that indexes are "properties with
values that can be converted to numbers via ToUInt32". I think you meant
something more like the text from 15.4:
A property name P (in the form of a String value) is an array index if and
> only if ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal
> to 2**32-1.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss