Set and Map iteration order

# Benjamin (Inglor) Gruenbaum (10 years ago)

I recently answered a question on StackOverflow about set iteration order which made me read the spec.

I remember the recent "Set.prototype.entries: indices as keys" discussion but I couldn't figure out if the fact sets and maps are ordered on insertion order is specified is intentional and an artifact. The spec looks crafted in a way it looks intentional, for example in set:

  • Set.prototype.add always adds to the end of the entries list
  • Set.prototype.delete does not delete from the list but rather sets the value to empty
  • Iteration in %SetIteratorPrototype%.next iterates entries by index and in order.

Am I understanding this wrong or is set iteration order specified (same for map)?

Can anyone please refer me to previous discussions on this when the decision was made? I can't seem to find the relevant material and I'm interested in the rationale.

Thanks again! Benjamin

# Brendan Eich (10 years ago)

esdiscuss.org/topic/set-iterators

(site: search again, but I admit I used deterministic and tyler close keywords to help.)

# Benjamin (Inglor) Gruenbaum (10 years ago)

We don't all have superpowers and know how to find targeted topics from 3 years ago :)

(I did google search, I'll work on my list search-fu)

# Brendan Eich (10 years ago)

Benjamin (Inglor) Gruenbaum wrote:

We don't all have superpowers and know how to find targeted topics from 3 years ago :)

(I did google search, I'll work on my list search-fu)

This one didn't require my elephantine memory :-P.

www.google.com/webhp?q=site:esdiscuss.org+"set+iteration"+order