Hey all, I thought I'd look at issue #6095 on codeplex (http://ironruby.codeplex.com/workitem/6095) as my first contribution.
Having a dig through the code lead me to ArrayOps which then lead me IListOps in the IronRuby.Libraries project. I noticed IListOps.Length had the [RubyMethod("count")] attribute method which only returned the arrays count. Have to some digging (and unneeded code writing then reverting) I looked at the ruby doc and saw Array mixed in Enumerable, looked around and found that IListOps was indeed marked to include Enumerable and sure enough found the 3 count methods. One for no parameters, one with, and one with a block that did all they were supposed to do. So the RubyMethod declaration for count in IListOps was overriding the method declarations in Enumerable once the ruby class was put together at runtime. I removed the RubyMethod declaration on IListOps compiled and ran the IronRuby console, tried out all three versions of count and they all worked. Now, I can see why the count declaration on IListOps was put there, because accessing the internal count property on RubyArray is much quicker than counting and iterating over the collection, however, the ruby methods length and size for quick access to the number of elements in the RubyArray. I see two ways of fixing the bug, 1. removing the [RubyMethod("count")] declaration from IListOps.Length which would make count inefficent on IList's. 2. reimplementing the object and block variations of count in IListOps In my humble opinion, 1 would be best, but since this is my first change I'd thought I'd get some input. Cheers, -- Nik Radford Mobile: 07884 254 866 Email: nikradf...@googlemail.com -- Nik Radford Mobile: 07884 254 866 Email: nikradf...@googlemail.com _______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core