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.
Kind regards
robert
···
On 06.11.2010 17:08, Jean-Christophe Le Lann wrote:
Hi
I think I have discovered a random bug in the& (set intersection)
operator in Arrays.
It statistically appeared 37 times out of 200 executions of my program.
on version ruby 1.9.1p376 (2009-12-07 revision 26041) [i686-linux]
on version ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]
I cannot deliver this full program (a source to source compiler) but
here is a example :
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 !
Regards
JCLL
···
Le 07/11/2010 11:40, Robert Klemme a écrit :
Hi
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.
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
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
···
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 !