Bug #14069

Document order of elements in Set

Added by abotalov (Andrei Botalov) about 3 years ago. Updated over 1 year ago.

Target version:
ruby -v:


Hash enumerates values in the insertion order.

Set is built on Hash so it does the same.
However, this is currently believed to be a not documented implementation detail. See:

I think it would be better to explicitly document that Set class enumerates keys in the insertion order.

Updated by jwmittag (Jörg W Mittag) almost 3 years ago

Is that actually guaranteed by the specification? Can you point to any specification or documentation or official statement by the core team that supports your assertion that sets are insertion-ordered?

Updated by jeremyevans0 (Jeremy Evans) over 1 year ago

  • Assignee set to knu (Akinori MUSHA)
  • Status changed from Open to Assigned

I believe the fact that sets are currently insertion ordered due to the use of hash is an implementation detail, and we shouldn't document it.


Updated by jeremyevans0 (Jeremy Evans) over 1 year ago

  • Status changed from Assigned to Rejected

Also available in: Atom PDF