[IronPython] Magic methods on CLR types
dinov at microsoft.com
Tue Dec 1 17:57:23 PST 2009
If you want IronPython to recognize them you just need to create an assembly w/ ExtensionTypeAttribute and have it point at the extended and extending types. Then the assembly needs to be loaded into the ScriptRuntime using ScriptRuntime.LoadAssembly.
We still need to figure out our story for recognizing and importing normal .NET extension methods that C# supports.
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Jeffrey Sax
Sent: Tuesday, December 01, 2009 5:27 PM
To: 'Discussion of IronPython'
Subject: [IronPython] Magic methods on CLR types
Is there a way to add magic methods like __repr__, __call__, etc. to CLR types?
1. Can it be done in the external CLR assembly without polluting the API for other languages? If so, how?
2. Can it be done using F# style type augmentations by redefining such methods on the Python type corresponding to the CLR type? If so, how?
3. If neither of these alternatives is possible, is there a third way?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Users