[IronPython] Plans for overloads?

Keith J. Farmer kfarmer at thuban.org
Wed Jul 20 01:02:24 CEST 2005

How would you specify:
T4 Foo<T1, T2>(T1, T3)
T4 Foo<T1, T2, T3>()
T4 Foo<T1, T2>(T3) 
T4 Foo<T1>(T2, T3)
T4 Foo(T1, T2, T3)
...? In other words, generic methods with overloads.  I'm pretty sure this is legal, but I don't have 2k5 in front of me to check.
I think you may need to add something to specify this, eg:
Foo[T1, T2 | T1, T3](x1, x3)
Foo[T1, T2, T3]()
Foo[T1, T2 | T3](x3)
Foo[T1 | T2, T3](x2, x3)
Foo[ | T1, T2, T3](x1, x2, x3)

From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Martin Maly
Sent: Tue 7/19/2005 2:45 PM

>>> Console.WriteLine[str]("Hi")
>>> Console.WriteLine[Single](3.5)
>>> Console.WriteLine[int]("Hi")
IronPython.Objects.PythonValueError: Bad args for the method <method#
WriteLine on System.Console>
>>> print Console.WriteLine[UInt64].__doc__
System.Void WriteLine(System.UInt64)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 4738 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20050719/6a4b5e1c/attachment.bin>

More information about the Ironpython-users mailing list