From: Reimer Behrends Date: 2004-08-08T14:31:21+09:00 Subject: Re: Sets are not extensional Kristof Bastiaensen (kristof@vleeuwen.org) wrote: [...] > As far as I know, hash.to_a always generates the same array. No. Hash#to_a will generate the same array for the same hash object, but for different hash objects with equal keys and values, it will not. Same for Hash#keys and Hash#values (Set#to_a is based on Hash#keys). $ cat hashtest.rb h = { }; 20.times{|i| h[i] = true };p h.keys h2 = { }; 20.times{|i| h2[19-i] = true };p h2.keys puts h == h2 $ ruby -v hashtest.rb ruby 1.8.1 (2003-12-25) [i686-linux] [16, 5, 11, 0, 17, 6, 12, 1, 18, 7, 13, 2, 19, 8, 14, 3, 9, 15, 4, 10] [5, 16, 0, 11, 6, 17, 1, 12, 7, 18, 2, 13, 8, 19, 3, 14, 9, 4, 15, 10] true Reimer Behrends