Daniele Alessandri
2009-Apr-16 21:20 UTC
[Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays
Hi, I have just filed this bug on CodePlex: http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=605 It is actually pretty easy to fix with a bunch of lines of code in RubyArray.GetHashCode (just tested, too bad IronRuby.dll is not open to contributions) and, as a result, this would resolve the following 4 critical failures for the array core specs: Array#hash properly handles recursive arrays Array#| properly handles recursive arrays Array#uniq properly handles recursive arrays Array#uniq! properly handles recursive arrays Regards -- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN
Shri Borde
2009-Apr-16 22:05 UTC
[Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays
I can fix RubyArray.GetHashCode to handle the simple case of an array containing itself. However, the simple fix wont deal with the case where the array is indirectly recursive as in this snippet. a = [] b = [a] a<<b -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Daniele Alessandri Sent: Thursday, April 16, 2009 2:20 PM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays Hi, I have just filed this bug on CodePlex: http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=605 It is actually pretty easy to fix with a bunch of lines of code in RubyArray.GetHashCode (just tested, too bad IronRuby.dll is not open to contributions) and, as a result, this would resolve the following 4 critical failures for the array core specs: Array#hash properly handles recursive arrays Array#| properly handles recursive arrays Array#uniq properly handles recursive arrays Array#uniq! properly handles recursive arrays Regards -- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Shri Borde
2009-Apr-16 22:22 UTC
[Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays
Curt pointed out a way to fix the recursive case using RubyUtils.RecursionTracker... -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shri Borde Sent: Thursday, April 16, 2009 3:06 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays I can fix RubyArray.GetHashCode to handle the simple case of an array containing itself. However, the simple fix wont deal with the case where the array is indirectly recursive as in this snippet. a = [] b = [a] a<<b -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Daniele Alessandri Sent: Thursday, April 16, 2009 2:20 PM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays Hi, I have just filed this bug on CodePlex: http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=605 It is actually pretty easy to fix with a bunch of lines of code in RubyArray.GetHashCode (just tested, too bad IronRuby.dll is not open to contributions) and, as a result, this would resolve the following 4 critical failures for the array core specs: Array#hash properly handles recursive arrays Array#| properly handles recursive arrays Array#uniq properly handles recursive arrays Array#uniq! properly handles recursive arrays Regards -- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Daniele Alessandri
2009-Apr-16 22:28 UTC
[Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays
Great, that''s exactly what I used :-) Thanks On Fri, Apr 17, 2009 at 00:22, Shri Borde <Shri.Borde at microsoft.com> wrote:> Curt pointed out a way to fix the recursive case using RubyUtils.RecursionTracker... > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shri Borde > Sent: Thursday, April 16, 2009 3:06 PM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays > > I can fix RubyArray.GetHashCode to handle the simple case of an array containing itself. > > However, the simple fix wont deal with the case where the array is indirectly recursive as in this snippet. > ?a = [] > ?b = [a] > ?a<<b > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Daniele Alessandri > Sent: Thursday, April 16, 2009 2:20 PM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays > > Hi, > > I have just filed this bug on CodePlex: > http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=605 > > It is actually pretty easy to fix with a bunch of lines of code in > RubyArray.GetHashCode (just tested, too bad IronRuby.dll is not open > to contributions) and, as a result, this would resolve the following 4 > critical failures for the array core specs: > > Array#hash properly handles recursive arrays > Array#| properly handles recursive arrays > Array#uniq properly handles recursive arrays > Array#uniq! properly handles recursive arrays > > Regards > > -- > Daniele Alessandri > http://www.clorophilla.net/blog/ > http://twitter.com/JoL1hAHN > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN
Tomas Matousek
2009-Apr-16 23:05 UTC
[Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays
Does Ruby call "hash" dynamically on each element of the array? If not then there is no need for RecursionTracker. A simple non-recursive DFS with a dictionary that remembers visited objects should do. Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Daniele Alessandri Sent: Thursday, April 16, 2009 3:29 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays Great, that''s exactly what I used :-) Thanks On Fri, Apr 17, 2009 at 00:22, Shri Borde <Shri.Borde at microsoft.com> wrote:> Curt pointed out a way to fix the recursive case using RubyUtils.RecursionTracker... > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shri Borde > Sent: Thursday, April 16, 2009 3:06 PM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays > > I can fix RubyArray.GetHashCode to handle the simple case of an array containing itself. > > However, the simple fix wont deal with the case where the array is indirectly recursive as in this snippet. > ?a = [] > ?b = [a] > ?a<<b > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Daniele Alessandri > Sent: Thursday, April 16, 2009 2:20 PM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays > > Hi, > > I have just filed this bug on CodePlex: > http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=605 > > It is actually pretty easy to fix with a bunch of lines of code in > RubyArray.GetHashCode (just tested, too bad IronRuby.dll is not open > to contributions) and, as a result, this would resolve the following 4 > critical failures for the array core specs: > > Array#hash properly handles recursive arrays > Array#| properly handles recursive arrays > Array#uniq properly handles recursive arrays > Array#uniq! properly handles recursive arrays > > Regards > > -- > Daniele Alessandri > http://www.clorophilla.net/blog/ > http://twitter.com/JoL1hAHN > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Tomas Matousek
2009-Apr-16 23:07 UTC
[Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays
See RubyFileOps.Join for an example. Tomas -----Original Message----- From: Tomas Matousek Sent: Thursday, April 16, 2009 4:06 PM To: ironruby-core at rubyforge.org Subject: RE: [Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays Does Ruby call "hash" dynamically on each element of the array? If not then there is no need for RecursionTracker. A simple non-recursive DFS with a dictionary that remembers visited objects should do. Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Daniele Alessandri Sent: Thursday, April 16, 2009 3:29 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays Great, that''s exactly what I used :-) Thanks On Fri, Apr 17, 2009 at 00:22, Shri Borde <Shri.Borde at microsoft.com> wrote:> Curt pointed out a way to fix the recursive case using RubyUtils.RecursionTracker... > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shri Borde > Sent: Thursday, April 16, 2009 3:06 PM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays > > I can fix RubyArray.GetHashCode to handle the simple case of an array containing itself. > > However, the simple fix wont deal with the case where the array is indirectly recursive as in this snippet. > ?a = [] > ?b = [a] > ?a<<b > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Daniele Alessandri > Sent: Thursday, April 16, 2009 2:20 PM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays > > Hi, > > I have just filed this bug on CodePlex: > http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=605 > > It is actually pretty easy to fix with a bunch of lines of code in > RubyArray.GetHashCode (just tested, too bad IronRuby.dll is not open > to contributions) and, as a result, this would resolve the following 4 > critical failures for the array core specs: > > Array#hash properly handles recursive arrays > Array#| properly handles recursive arrays > Array#uniq properly handles recursive arrays > Array#uniq! properly handles recursive arrays > > Regards > > -- > Daniele Alessandri > http://www.clorophilla.net/blog/ > http://twitter.com/JoL1hAHN > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Curt Hagenlocher
2009-Apr-17 02:00 UTC
[Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays
The simple test I did suggested that MRI dynamically calls hash on each element of the array. -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Tomas Matousek Sent: Thursday, April 16, 2009 4:08 PM To: Tomas Matousek; ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays See RubyFileOps.Join for an example. Tomas -----Original Message----- From: Tomas Matousek Sent: Thursday, April 16, 2009 4:06 PM To: ironruby-core at rubyforge.org Subject: RE: [Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays Does Ruby call "hash" dynamically on each element of the array? If not then there is no need for RecursionTracker. A simple non-recursive DFS with a dictionary that remembers visited objects should do. Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Daniele Alessandri Sent: Thursday, April 16, 2009 3:29 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays Great, that''s exactly what I used :-) Thanks On Fri, Apr 17, 2009 at 00:22, Shri Borde <Shri.Borde at microsoft.com> wrote:> Curt pointed out a way to fix the recursive case using RubyUtils.RecursionTracker... > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shri Borde > Sent: Thursday, April 16, 2009 3:06 PM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays > > I can fix RubyArray.GetHashCode to handle the simple case of an array containing itself. > > However, the simple fix wont deal with the case where the array is indirectly recursive as in this snippet. > ?a = [] > ?b = [a] > ?a<<b > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Daniele Alessandri > Sent: Thursday, April 16, 2009 2:20 PM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] Bug filed: Array#hash should properly handle recursive arrays > > Hi, > > I have just filed this bug on CodePlex: > http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=605 > > It is actually pretty easy to fix with a bunch of lines of code in > RubyArray.GetHashCode (just tested, too bad IronRuby.dll is not open > to contributions) and, as a result, this would resolve the following 4 > critical failures for the array core specs: > > Array#hash properly handles recursive arrays > Array#| properly handles recursive arrays > Array#uniq properly handles recursive arrays > Array#uniq! properly handles recursive arrays > > Regards > > -- > Daniele Alessandri > http://www.clorophilla.net/blog/ > http://twitter.com/JoL1hAHN > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-- Daniele Alessandri http://www.clorophilla.net/blog/ http://twitter.com/JoL1hAHN _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core