[IronPython] Overloads

Martin Maly martmaly at exchange.microsoft.com
Thu Aug 4 07:43:55 CEST 2005

The ref argument is, unfortunatelly, a bug. The conversion code tries to
convert int into int& which it fails to do. I'll get the fix out in the
next release.


-----Original Message-----
From: users-ironpython.com-bounces at lists.ironpython.com
[mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of
Jonathan Jacobs
Sent: Wednesday, August 03, 2005 12:51 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Overloads

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!

users-ironpython.com mailing list
users-ironpython.com at lists.ironpython.com

More information about the Ironpython-users mailing list