[Ironruby-core] Calling constructor when static .New() method is defined

Philippe Leybaert philippe at activa.be
Tue Jun 29 12:56:47 EDT 2010


Shay Friedman suggested I'd post this to the mailing list, as it may be a bug in IronRuby:

It seems impossible to call a constructor when there is a static .New() method defined on a class.

This is a minimal test case demonstrating the problem:

.NET (C#) class:

    public class Tester
    {
        public static void New()
        {
            Console.WriteLine("In Tester.New()");
        }

        public Tester()
        {
            Console.WriteLine("In constructor");
        }
    }

IronRuby code:

    Tester.new
    Tester.New

The ruby code above calls Tester.New() in both cases. There seems to be no way to call the regular constructor of this class.



More information about the Ironruby-core mailing list