-
Notifications
You must be signed in to change notification settings - Fork 350
importextsion for generic container interface #1289
Comments
I assume you've tried using Does calling the extension method as a plain static method work? That is:
Side note: those Poll methods are basically the worst-case scenario for binding Python to .NET - extension methods, out/ref parameters, default values - all of which should be handled, but sheesh. |
Pretty much a perfect storm -- that was my conclusion too. I've bypassed the issue by branching the clrzmq4 library and directly implementing the core of the backend namespace in C#. Our lawyers are all up in my business about shipping a compiled modified library but I had to stop cutting bait and start fishing. The repro instructions from #1290 will set you up, just checkout the pyzmq repro from before the changes to clrzmq4, the "Polling is hard" changeset swn1/pyzmq@5db4b3b |
I don't recall if I tried calling it as a static method. I think I did but IEnumerable is a (generic) interface and I don't see any way in IronPython to instantiate something that will cause the overload resolution to pick the right overload. If I recall correctly I did try to set up such a call and gave up. |
So I had a chance to actually play with this in an interpreter, just using Linq. Let me know if there's something I've missed in your scenario, because it seems to work for me:
So it should be picking up the extensions, even if you're using a plain Python list. |
My understanding of importextensions was broken. I didn't try the construction you're using above. Based on a breadcrumb I found somewhere I thought I understood the operand of ImportExtensions to be a Python type that would be patched with any suitable methods. So I was trying to construct a concrete type that would do what I needed. I think I understand what your example is doing now, I'll back up and take another shot at ZeroMQ. Thank you! |
It looks like this was resolved, is that correct? |
I have been working on other tasks and was hoping to return to the On Mon, Aug 1, 2016 at 3:13 PM, Alex Earl notifications@github.com wrote:
|
I could not make it work with a plain python list but when I switched to a System.List[ZSocket] instance it picked up the extension method right away. To get the correct overload I also had to change some of the other actual parameters to specific C# types. Thanks for the pointers! |
I am trying to implement a thin layer of glue between pyzmq and clrzmq4. The latter exposes some key functionality as extension methods over IEnumerable, a generic interface type specialized to a concrete type exposed by the same library.
Working in IronPython 2.7.5 on the 4.0 framework, I've not been able to make any headway on getting this to work. The library code in question is here:
https://github.com/zeromq/clrzmq4/blob/master/ZPollItems.cs
#1229 appears to be relevant but doesn't specifically address interfaces, I'm wondering if that's why it isn't working for me? I'd prefer not to have to push a change into the clrzmq4 project.
The text was updated successfully, but these errors were encountered: