[Ironruby-core] C# Overloads and IronRuby Classes

Tomas Matousek Tomas.Matousek at microsoft.com
Tue Jul 14 16:57:48 EDT 2009

Looks like a bug.


-----Original Message-----
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman
Sent: Tuesday, July 14, 2009 1:42 PM
To: ironruby-core at rubyforge.org
Subject: [Ironruby-core] C# Overloads and IronRuby Classes

Hi there,

The next scenario worked for me on older versions but now the behavior changed and I'd like to know if the change is a bug or by design.

This is my C# code:
public class MyClass {
  public void A() { A(1); }
  public void A(int val) { A(val, "foo"); }
  public void A(int val, string str) { Console.WriteLine("{0} - {1}", val, str); } }

And now in IR:
class IronRubyRulez < MyClass; end
test = IronRubyRulez.new
test.a # Prints "1 - foo"
test.a(5) # Prints "5 - foo"
test.a(7, "boom") # Prints "7 - boom"

So far so good... but now I'd like to override the method "a":
class IronRubyRulez < MyClass
  def a
test = IronRubyRulez.new
test.a # Error! wrong number of arguments (2 for 0)

This worked on older versions and resulted with "12 - foo".
Bug or by design?

Shay Friedman
Follow me: http://twitter.com/ironshay
Posted via http://www.ruby-forum.com/.
Ironruby-core mailing list
Ironruby-core at rubyforge.org

More information about the Ironruby-core mailing list