Hi --

On Sat, 14 Feb 2009, James Coglan wrote:

>>
>>
>>> Seconded -- 1.8.7 is precisely where my code that was relying on insertion
>>> order *does not work*. Actually let me be more specific. My code was
>>> relying
>>> on keys being inserted in the order they appear in a hash literal, and on
>>> subsequent iteration occuring in the same order.
>>>
>>
>> That doesn't happen in any 1.8 version, though. (Sorry; I feel like
>> something's going right past me, and I'll stop after this iteration
>> :-)
>
>
>
> Regardless of whether they're *supposed* to, the Rubies I've used before
> 1.8.7 actually do iterate in insertion order. Could be machine/OS specific,
> a fluke, whatever. The point is that 1.8.7 definitely does not iterate in
> the order that keys appear in a literal, at least on my machine. If this is
> supposed to now be defined behaviour I'll investigate further and file a bug
> if necessary.

I think it probably is machine-dependent, or something like that. I've
never heard of hash order being anything but "not guaranteed" before
1.9 -- except that if you iterate twice, I believe it definitely
happens in the same order both times (though I'm not 100% sure that
that's actually specified or guaranteed either).


David

-- 
David A. Black / Ruby Power and Light, LLC
Ruby/Rails consulting & training: http://www.rubypal.com
Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2)

http://www.wishsight.com => Independent, social wishlist management!