In addition to the memory efficiency we get correctness in supporting re-assignment to __class__. All of the types derived from one built-in type share the same in-memory layout. Therefore __class__ can be assigned arbitrarily between them changing the underlying dynamic type - just like CPython.
The one other way to interop would be via interfaces. This has different pros and cons but is worth considering depending on what you're doing. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Foord Sent: Sunday, February 18, 2007 5:36 AM To: Discussion of IronPython Subject: Re: [IronPython] Using a Python-Module from other Languages over .NET? kls wrote: > Hi, > > i have a litle question: Is it possibel to compile a Python-Module with > IronPython with all dependencies to a .Net-Module with can used from > other Languages like VB over .NET? > > Not directly I'm afraid. The .NET garbage collector doesn't collect classes, so for memory efficiency reasons (? - only ?) IronPython re-uses a single (?) class definition internally. That means that IronPython classes can't be consumed directly from other languages. You can create stub wrapper classes in C# / VB.NET which call into the engine and use your classes. This is quite simple and somewhere on this list someone posted an example. Using the System.Reflection API it should be possible to automate creating these stub classes. I haven't had time to explore this myself, but it would be very interesting. All the best, Michael Foord http://www.voidspace.org.uk/ironpython/ > Thx for the answers > _______________________________________________ > users mailing list > [email protected] > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
