[IronPython] Choosing the right overload

Martin Maly Martin.Maly at microsoft.com
Fri Jun 16 16:40:03 CEST 2006


The array_EffectInstance is EffectInstance[] and to get that type, you can do:

clr.GetClrType(Direct3D.XXXXX.EffectInstance).MakeArrayType()

For example:

>>> clr.GetClrType(System.Collections.Hashtable).MakeArrayType()
System.Collections.Hashtable[]

Hope this helps.
Martin

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jonathan Jacobs
Sent: Friday, June 16, 2006 3:25 AM
To: IronPython List
Subject: [IronPython] Choosing the right overload

Hi,

I'm wondering how to call a specific overload, more specifically one that in
C# would take an out parameter but in IronPython does/can not.

Here are the available overloads:

 >>> print Direct3D.Mesh.FromFile.__doc__
static (Mesh, array_EffectInstance) FromFile(str filename, MeshFlags options,
Device device)
static (Mesh, GraphicsStream, array_EffectInstance) FromFile(str filename,
MeshFlags options, Device device)
static (Mesh, array_ExtendedMaterial, array_EffectInstance) FromFile(str
filename, MeshFlags options, Device device)
static Mesh FromFile(str filename, MeshFlags options, Device device)
static (Mesh, GraphicsStream) FromFile(str filename, MeshFlags options, Device
device)
static (Mesh, array_ExtendedMaterial) FromFile(str filename, MeshFlags
options, Device device)
static (Mesh, GraphicsStream, array_ExtendedMaterial) FromFile(str filename,
MeshFlags options, Device device)
static (Mesh, GraphicsStream, array_ExtendedMaterial, array_EffectInstance)
FromFile(str filename, MeshFlags options, Device device)

I want to call:

static (Mesh, array_ExtendedMaterial) FromFile(str filename, MeshFlags
options, Device device)

I've tried using __overloads__:

 >>> print Direct3D.Mesh.FromFile.__overloads__[(str, Direct3D.MeshFlags,
Direct3D.Device)].__doc__
static Mesh FromFile(str filename, MeshFlags options, Device device)

I'm going to assume that I'd need some way to specify the return type, which
also makes me wonder how you'd specify an object of type array_ExtendedMaterial?

So, is there a way I can do this without resorting to writing a C# helper
function?

I'd also like to suggest that the representation of the "keys" in
__overloads__ change to look something a little more like what you need to
pass. For instance:

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

would be more easily understood (IMO) if it looked like:

(str, MeshFlags, Device): <built-in function FromFile>

Regards
--
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
_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list