From: Pit Capitain Date: 2009-02-13T18:11:18+09:00 Subject: Re: Hash order (was: Re: If you are unhappy with the direction of Ruby 1.8.7+, respond) 2009/2/13 James Coglan : > I would concede that this is something of a grey area as it's neither a bug > fix or an explicit feature addition, but the question was asked about 1.8.6 > code that broke, and this is an example. James, maybe you missed ruby-talk:327937 (http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/327937). Your code isn't working reliably even on 1.8.6. Look at this IRB session I've just run on my ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]: irb(main):001:0> {2 => 0, 1 => 0} => {1=>0, 2=>0} irb(main):002:0> {:a => 0, :z => 0} => {:a=>0, :z=>0} irb(main):003:0> As you can see, in one case the hash is iterated over in insertion order, in the other case not. It depends on the hash keys and maybe other factors. If your code was working for you you've just been lucky, but you can't claim that this is an example for code that was working on 1.8.6. The code was broken in 1.8.6 and still is broken in 1.8.7, and 1.8.7 even helped you find the bug in your code, as someone else had said already. Regards, Pit