|
The [] syntax is for generic types - not
for method overloads. Just for more info on method overloads in
general – for those that have multiple method bindings we’ll hit our
ReflectedMethodBase.TryCall implementation. That will evaluate the
conversions for each argument and methods and will ultimately dispatch to the method
that has better conversions. If two methods have “mixed”
conversions [(one “good”, one “bad”) / (one “bad”,
one “good”) ] then we’ll just end up picking the first
method. We also take into account various other factors such as if we’re
turning the first argument into a this pointer and we’ll have non-params
arguments over params arguments. It’s also worth pointing out this
whole process is slow…. For optimized calls (currently just core
built-in CLR types and types the IronPython runtime exposes) we’ll
generate fast-paths for methods that don’t have multiple bindings. Our
definition of multiple bindings is methods that have 1 overload for each number
of parameters (eg 1 overload that takes 1 parameter, 1 overload that takes 2 parameters,
etc…) and methods that only have 1 params method. If the method
falls outside of this it’s not optimized. That’s an
implementation detail that probably no one needs to know, but I’m just
throwing it out there for completeness. We’re also looking at
improving our optimizer so it can optimize more methods this way (and there
probably deserves some thought about how we can allow user-methods to be
optimized when hosting IronPython as well). From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of J. Merrill Isn't there a syntax (using []) by which you can tell IP explicitly
which one it should use? I was expecting you to say what you did, but to
add info about that as well. 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 & and we want to hear about
those cases so we can fix them. From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
On Behalf Of Fabio
|
_______________________________________________ users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
