On 14.11.2007 13:34, Rick DeNatale wrote:
> On Nov 14, 2007 7:01 AM, Devi Web Development <devi.webmaster / gmail.com> wrote:
>> On Nov 13, 2007 4:03 PM, Trans <transfire / gmail.com> wrote:
>>>> (2) A hash with multiple keys for a value.
>>> How does that behave like an ordered hash?
>> An Ordered hash presumably serves the purpose of lookup of a value by
>> an integer, like an array, or by a normal arbitrary key
>
> No, for most people, based on quite a long thread referenced by Bill
> Kleb, it's a normal hash except that the order that elements are
> yielded by each, each_key, each_value... is defined to be the temporal
> order of insertion into the hash.
Well, that's just /one/ way to order a Hash. You could as well order a
Hash by the key's natural order (<=>).
> In Ruby 1.8 the enumeration order of a Hash is undefined, in Ruby 1.9,
> unless it's been backed out recently, it's defined as above.
Does Ruby 1.9 really impose the overhead to maintain insertion order for
*every* Hash?
Kind regards
robert