[IronPython] Choosing the right overload

Jonathan Jacobs korpse-ironpython at kaydash.za.net
Fri Jun 16 19:21:37 CEST 2006


J. Merrill wrote:
> If you know where the "out" parameter goes in the parameter list (e.g. at
> the end) you could specify a tuple that includes it in the right spot.
> Martin has shown you how to define the array.

I didn't know about the array type trick but I'm still having some trouble.
This is the overload I want:

'static (Mesh, array_ExtendedMaterial) FromFile(str filename, MeshFlags
options, Device device)': <built-in function FromFile>

The function's C# signature is:

public static Mesh FromFile(string, MeshFlags, Device, out ExtendedMaterial);

So I tried:

>>> Direct3D.Mesh.FromFile.__overloads__[(str, Direct3D.MeshFlags,
Direct3D.Device, clr.GetClrType(Direct3D.ExtendedMaterial).MakeArrayType())]
Traceback (most recent call last):
   File , line 0, in <stdin>##22
   File , line 0, in get_Item##18
TypeError: No match found for the method signature (<type 'str'>, <type 
'MeshFlags'>, <type 'Device'>, Microsoft.DirectX.Direct3D.ExtendedMaterial[])

> I don't know if C# allows overloads that are identical except for out-ness
> -- can you have both int Foo(string x, out int blah) and int Foo(string x,
> int blah) ???

Apparently you can.

-- 
Jonathan

When you meet a master swordsman,
show him your sword.
When you meet a man who is not a poet,
do not show him your poem.
                 -- Rinzai, ninth century Zen master



More information about the Ironpython-users mailing list