From: Robert Klemme Date: 2010-11-07T19:40:18+09:00 Subject: Re: random bug in the & (set intersection) operator in Arrays 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 : > > array1 = [#, > #, > #, > #], @cond=true>] > ======================================== > array2 = [#, > #, > #], @cond=true>, > # #], @cond=true>, > #]>] > ======================================== > array1& array2 sometimes gives things like : > > [#, > #, > #, > #], @cond=true>] > > while the expected result is > > [#, > #, > #], @cond=true>] > > How can I report that ? Thx > JCLL > (ps : using Set instead of Array, this works perfectly) 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 -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/