allen at wirfs-brock.com
Wed Feb 15 08:33:55 PST 2012
On Feb 14, 2012, at 10:41 PM, Mark S. Miller wrote:
> On Tue, Feb 14, 2012 at 10:05 PM, Gavin Barraclough <barraclough at apple.com> wrote:
> Do you think we want strict insertion order, including for numeric index properties? I guess I'm thinking the obvious here ( http://wiki.ecmascript.org/doku.php?id=strawman:enumeration ), but it would seem a simplest for users if there were a single story for iteration order.
> Great question. I hadn't thought about that in this context, but I do find it attractive. Ironically, this might be less efficient than pure insertion order. But worrying about that too early without measurement or evidence would again be premature. It also accommodates Allen's specialized collection as simply a degenerate case. Cool.
I think we need to be clear what we are talking about here. The title of this thread is "Set iterators" and the ordering discussion started in the context of iterator order for the default Set iterator. The issue of iterating "numeric indexed properties" doesn't arise for the default Set iterator.
The numeric indexed properties questions only arises where we are talking about the default iterator for plain vanilla objects which iterates over properties.
In general, objects can provide their own default iterator and defining the scope and order of iteration should be part of defining any object based abstraction. Iteration needs to make sense in terms of the abstraction. The specific choices about iteration made for Sets, Maps, or plain vanilla objects shouldn't be biasing the iteration design of other abstractions.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss