From: Robert Klemme Date: 2010-11-07T20:55:16+09:00 Subject: Re: random bug in the & (set intersection) operator in Arrays On 07.11.2010 12:06, Jean-Christophe Le Lann wrote: > Le 07/11/2010 11:40, Robert Klemme a écrit : >>> I think I have discovered a random bug in the& (set intersection) >>> operator in Arrays. >> >> Well, Set's implementation and Array's are different. I believe Array >> does not use #hash while Set does to efficiently find equivalent >> instances. Can you show the code for Say#eql?, Say#hash and Say#== >> (same for all other classes whose instances are put into your Arrays)? >> I am not convinced yet that you found a bug. > I have no such methods. I simply though that the object IDs would be > used for the intersection of the two arrays. Am I wrong ? Thx for your > time and explanations ! As long as you define equivalence solely based on object identity you do not need specific implementations of #hash and #eql?. You can find a bit of explanation here http://blog.rubybestpractices.com/posts/rklemme/018-Complete_Class.html Still it would be good if you could provide a simple test case that reproduces the problem. You need that for a bug report anyway. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/