On 07.11.2010 12:06, Jean-Christophe Le Lann wrote:
> Le 07/11/2010 11:40, Robert Klemme a =E9crit :

>>> 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#=3D=3D=

>> (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=20
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=20
reproduces the problem.  You need that for a bug report anyway.

Kind regards

	robert

--=20
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/