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: [email protected] 
[mailto:[email protected]] 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?

Thanks!

Jeffrey Sax
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to