Issue #5123 has been updated by headius (Charles Nutter).


The decision is already made. Hash has been ordered since 1.9.1 (or 1.9.2?) and changing it now would break all code that expects ordering. Ordering also does not necessarily limit options for implementation...it just makes certain implementations less efficient.

There's a separate bug still being evaluated to add RBTree to core...perhaps that would fulfill what you need?
----------------------------------------
Feature #5123: Alias Hash 1.9 as OrderedHash
https://bugs.ruby-lang.org/issues/5123#change-32122

Author: alexeymuranov (Alexey Muranov)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: next minor


I read that it was a controversial decision to make Hash in Ruby 1.9 ordered.
It is not clear if the present implementation is the best possible.
I would like to express my thought.

It would be nice if the ordered Hash in Ruby 1.9 was aliased as OrderedHash.
That way people who rely on preserving the insertion order in some application (me, for example) could explicitly use OrderedHash, and developers of Ruby would be free to redefine Hash in future versions if a better implementation that a doubly-linked circular list is found.
(I read something about a possibility of using "red???black tree".)

Thanks.

Alexey Muranov.


-- 
http://bugs.ruby-lang.org/