Be careful with that assumption. I believe that as a hash expands it
occasionally needs to re-hash it's keys, and that would alter the order.
I don't know that Ruby's hash works that way, but most of the ones I've
encountered do.
See [ruby-talk:44548] and [ruby-talk:12151], there is
what case? i’d like to see an example. i worry about depending on that.
what if something changes in Ruby 1.7+ and the orders start coming out
different?
~transami
···
On Mon, 2002-07-15 at 03:12, ts wrote:
how do you utilize that order?
I use it in this case
Well, try #each, #keys and #values and you’ll see that the objects are
given in the same order : this is (for me) important
Be careful with that assumption. I believe that as a hash
expands it
occasionally needs to re-hash it’s keys, and that would alter
the order.
I don’t know that Ruby’s hash works that way, but most of the
ones I’ve
encountered do.
See [ruby-talk:44548] and [ruby-talk:12151], there is
“(if you don’t modify the hash)”
It’s probably a semantic argument at this point and what is working
for you seems to work for you, but I’d would NOT call a data
structure which maintains an order with no relationship to the order
that the items were inserted, and can (and will!) change its order
whenever its contents are changed “ordered”.