Skip to content

Seeking Feedback for Potential PR: Method Binder IsAssignable From #529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jaredbroad opened this issue Aug 25, 2017 · 2 comments
Open

Comments

@jaredbroad
Copy link

jaredbroad commented Aug 25, 2017

One of our team (@mchandschuh) suggested this line could be substituted for a "IsAssignableFrom" check. https://github.com/pythonnet/pythonnet/blob/master/src/runtime/methodbinder.cs#L60

The plan would be to make the generic-locator code more effective.

mhandschuh [4:11 PM]
I would recommend looking at the MethodBinder -- it appears to be matching directly on type and not using Type.IsAssignableFrom which should properly handle super types (going from SimpleMovingAverage to IndicatorBase)

We're not really sure the flow on impacts for the whole library -- is this feasible; or are other parts of the code dependent on this = statement?

@jaredbroad jaredbroad changed the title Suggestion / Seeking Feedback for Potential PR: Seeking Feedback for Potential PR: Method Binder IsAssignable From Aug 25, 2017
@mchandschuh
Copy link

My python skills are severely lacking, so I'll just ask here.

Is there a test that verifies derived types can be passed as arguments to functions?

Does pythonnet support invoking the AcceptsBaseClass method with an instance of SubClass ?

class BaseClass { }
class SubClass : BaseClass { }
static class Method
{
    public static void AcceptsBaseClass(BaseClass arg) { }
}

Thanks!

@den-run-ai
Copy link
Contributor

@jaredbroad @mhandschuh @AlexCatarino the issue is much deeper. As a starter take a look at this PR which I gave up on merging:

#217

For more of overloading stuff have a look at this meta-issue (this is one of my frequent nightmares):

#265

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants