[IronPython] Plans for overloads?

Martin Maly martmaly at exchange.microsoft.com
Fri Jul 15 22:29:50 CEST 2005


The  

> Jonathan Jacobs Wrote:
> 
> At the moment "out" parameters are not really taken into 
> account when matching up signatures, if I'm not mistaken, is 
> this going to be addressed?

The out parameters are the trickiest part. The solution we are working
on will hopefully address that problem. If not (or if it is not a pretty
one for the out parameters) we will keep looking. The ultimate goal
is to achieve state where we can call any particular method without
ambiguity, and also do that within the limitations of Python syntax
(i.e. Python code object.method(out x) ... is not really an option)

> Something that crossed my mind (and I know it's not really very
> "Pythonic") regarding "out" parameters was: What about 
> passing a type in the place of an out object, so that you can 
> match up exactly which overload the programmer wants to use?

We are actually going to do something quite similar. Since I am just
beginning to write the code for the method 'pinpointing', I'll have
some results later today or after the weekend. Then I'll send along
more information.

> A little off-topic, I was wondering about kwargs support for 
> reflected methods.

The kwargs support you are seeing is to enable setting properties at
construction time. For example:

import sys
sys.LoadAssemblyByName("System.Windows.Forms")
from System.Windows.Forms import *

f = Form(Text = "Hello")			# <<= the call

I agree with you that the kwargs on reflected methods are not as useful
as when calling Python methods. For C# programmers that is. Visual Basic
programmer could disagree since VB supports passing arguments by name:

Public Class Class1
    Public Sub Test(ByVal name As String, ByVal age As Integer)

    End Sub

    Public Sub X()
        Test(age:=10, name:="foo")
    End Sub
End Class

You are therefore bringing a very interesting point with the kwargs
support
for reflected methods and we should definitely give it a thought.

Martin



More information about the Ironpython-users mailing list