<html>
Clearly, having IP make the right which-overload decision a very high
percentage of the time is desirable, but it's not a &quot;portability of
my Python code&quot; issue if I need to do something special to invoke
the desired overload.&nbsp; But it is _critical_ that we be able to
determine, in IP alone (without VS debugger), which overload was actually
selected.<br>
<br>
One solution would be to provide a way to iterate (in Python) through the
(presumed by me to exist, without looking at the code) internal structure
that describes the cached mapping of whatever-is-that-is-stored to .Net
MethodInfo objects.<br>
<br>
Providing access to that structure as a Python dictionary (perhaps
__overloads__ within Python function/method objects?) could permit user
code to add and/or change entries and thus control things when that is
needed.&nbsp; It would also let us write tests that exercise the IP code
that makes the decisions and be certain that the results are as desired
-- without having to write .Net methods that have particular parameter
patterns and that somehow inform us about what the choice was.<br>
<br>
[Thinking out loud] Hmm, a Python program that took a .Net assembly/class
spec, reflected through its callable methods, and produced a c# source
file that defined IPOverloadTest_classname_methodname methods with the
same signatures as all the methods with multiple overloads, where the
implementation somehow records that it's been called, would not be that
hard to write.&nbsp; So perhaps the &quot;so we can write tests of the
overload resolution mechanism&quot; use for what I described above would
not be necessary.&nbsp; (Has anyone there written this?&nbsp; Should one
of us?)<br>
<br>
Good luck trying to figure out the best way to do this!!<br>
<br>
At 02:18 PM 1/9/2006, Martin Maly wrote<br>
<br>
<blockquote type=cite cite><font face="verdana" size=2 color="#800000">There
is a syntax for selecting the overload. However, I didn t mention it
because we want to achieve state where the automatic binding we have
satisfies most uses. More importantly, the selection mechanism may change
in the near future.<br>
</font><br>
<font face="verdana" size=2 color="#800000">&nbsp;<br>
</font><br>
<font face="verdana" size=2 color="#800000">Having said that, yes, it is
possible to select the very overload by using the square bracket syntax.
However, this may change during our beta cycles so try to not depend on
it too much.<br>
</font><br>
<font face="verdana" size=2 color="#800000">&nbsp;<br>
</font><br>
<font face="verdana" size=2 color="#800000">Martin<br>
</font><br>
<font face="verdana" size=2 color="#800000">&nbsp;<br>
</font><br>
<font face="verdana" size=2 color="#800000">&gt;&gt;&gt; from System
import Console<br>
</font><br>
<font face="verdana" size=2 color="#800000">&gt;&gt;&gt;
Console.Write(3)<br>
</font><br>
<font face="verdana" size=2 color="#800000">3&gt;&gt;&gt;
Console.Write[str](3)<br>
</font><br>
<font face="verdana" size=2 color="#800000">Traceback (most recent call
last):<br>
</font><br>
<font face="verdana" size=2 color="#800000">&nbsp; File , line 0, in
input##2<br>
</font><br>
<font face="verdana" size=2 color="#800000">TypeError: bad args to this
method &lt;method# Write on System.Console&gt;<br>
</font><br>
<font face="verdana" size=2 color="#800000">&gt;&gt;&gt; <br>
</font><br>
<font face="verdana" size=2 color="#800000">&nbsp;<br>
<hr>
<div align="center">
</font></div>
<font face="tahoma" size=2><b>From:</b>
users-bounces@lists.ironpython.com [<a href="mailto:users-bounces@lists.ironpython.com" eudora="autourl">mailto:users-bounces@lists.ironpython.com</a>] <b>On Behalf Of </b>J. Merrill<br>
<b>Sent:</b> Monday, January 09, 2006 9:32 AM<br>
<b>To:</b> Discussion of IronPython<br>
<b>Subject:</b> Re: [IronPython] Method overload<br>
</font><br>
<font face="Times New Roman, Times">&nbsp;<br>
</font><br>
<font face="Times New Roman, Times">Isn't there a syntax (using []) by which you can tell IP explicitly which one it should use?&nbsp; I was expecting you to say what you did, but to add info about that as well.<br>
<br>
At 12:48 AM 1/8/2006, Martin Maly wrote<br>
<br>
</font><font face="verdana" size=2 color="#800000">Yes, it will work on .NET. IronPython will try to find the best fit among the overloads based on types of arguments that you pass to the method call. There may be cases when IronPython may not choose the right method &amp; and we want to hear about those cases so we can fix them.<br>
</font><br>
<font face="verdana" size=2 color="#800000">Martin<br>
<hr>
<div align="center">
</font></div>
<font face="tahoma" size=2><b>From:</b> users-bounces@lists.ironpython.com [<a href="mailto:users-bounces@lists.ironpython.com" eudora="autourl">mailto:users-bounces@lists.ironpython.com</a>] <b>On Behalf Of </b>Fabio<br>
<b>Sent:</b> Saturday, January 07, 2006 4:42 PM<br>
<b>To:</b> IronPython<br>
<b>Subject:</b> [IronPython] Method overload<br>
</font><br>
I'm studing IronPython and I liked very much!<br>
But I have one question.<br>
<br>
In .Net Framework, several classes has method overload. In my study, Python does not support method overload, and when we define&nbsp; methods with the same name, they are redefined then only the last is used.<br>
<br>
How IronPython handle this? By example, the method &quot;<font size=2>System.Console.Write()&quot; has 18 overloads! This will work in .Net?<br>
</font><br>
<font size=2>Regards<br>
Fabio</font></blockquote><br>
<br>
J. Merrill / Analytical Software Corp
</html>