[IronPython] Overloads

Jonathan Jacobs korpse-ironpython at kaydash.za.net
Wed Aug 3 21:50:49 CEST 2005


Martin Maly wrote:
> the Random.Next is not a static method. You can either pass the instance as the first argument:

Hi Martin,

Yes, I figured that out a little while later. Too bad I had already made 
a fool of myself. ;-)

> However, I think your question brings up a valid point ... how do we distinguish between static and instance methods in the __doc__ strings? Surely there is not difference now and that is confusing.

Fair enough. Something else that struck me while I was fishing around 
was that the doc string for both "ref" and "out" parameters show 
"<typename>&" (where "<typename>" appears as the real type name).

Which, in turn, got me thinking about how one would go about specifying 
an overload for methods that took ref/out params?

And finally, I'm having trouble calling functions with "ref" parameters:

 >>> print Foo.__doc__
int Foo(System.Int32&)
 >>> a = 5
 >>> Foo(a)
IronPython.Objects.PythonValueError: Bad args for the method <method# 
Foo on Sanity.Util.Helpers>
    at input_5.Run(Frame frame)

Where "Foo" is defined as:

public static int Foo(ref int a) {
     a *= 2;
     return a * 2;
}

Other than that, the new overload selector stuff lets me dump a whole 
bunch of my C# helper functions I had previously needed. Huzzah!

Keep the good stuff coming!

--
Jonathan



More information about the Ironpython-users mailing list