From: Julian Leviston Date: 2010-07-13T11:09:59+09:00 Subject: Re: Arrays and Hashes Yes. An orderedhash object is present in libraries such as activesupport because this feature can be useful. Its not very often that you need it ordered but every now and then it can come in handy. I sometimes wish ruby had the rich tapestry of collection types that smalltalks such as gemstone avail their users of. For example, a bag is an unordered collection. Some collections don't allow multiples, others are faster... Etc Blog: http://random8.zenunit.com/ Twitter: http://twitter.com/random8r Learn: http://sensei.zenunit.com/ New video up now at http://sensei.zenunit.com/ real fastcgi rails deploy process! Check it out now! On 13/07/2010, at 9:40 AM, Rein Henrichs wrote: > On 2010-07-12 12:01:20 -0700, Jacob Mitchell said: > >> [Note: parts of this message were removed to make it a legal post.] >>> I may not getting your point clear. What is it not applicable to Ruby >>> 1.9 from what Jake said? >>> Ruby 1.9 added a constraint that whenever you query for an iterator using >> any of the Hashes each* methods, you'll always get the objects in the same >> order that they were inserted into that hash. Prior to that there were no >> promises about the order the elements would be yielded by the iterator. >> -Jake > > In practice, hash order (for 1.8) is deterministic *per machine*, meaning the hash will enumerate in the same order each time for you, but not in the same order as someone else's machine. > > That said, this must not be relied on (after all, it isn't in the spec). One should not expect hashes to be ordered, and any code in Ruby 1.8 that treats the order of a hash as significant is incorrect. > > -- > Rein Henrichs > http://puppetlabs.com > http://reinh.com > >