[IronPython] Exporting Python code as an assembly
Curt Hagenlocher
curt at hagenlocher.org
Mon Feb 4 19:31:10 CET 2008
After a bit of spare-time hacking this weekend, I've got a
"proof-of-concept" program that takes a Python class and exports it as a
(statically-defined) assembly. It uses Pythonic function annotations to
signal attributes and input and output types to the wrapper generator. You
end up with something like this
def Test(object):
@ClrAttribute(Xunit.FactAttribute)
def WorthlessTest(self):
Xunit.Assert.Equal[type(1)](1, 1)
@ClrAccepts(System.String, System.Int32)
@ClrReturns(System.Int32)
def CalculateValue(self, s, i):
return len(s) + i
The program takes this source and spits out a DLL containing the class
"Test" which implements "WorthlessTest" and "CalculateValue". The class
itself contains a reference to the actual Python object, and each of the
public functions simply delegates to the Pythonic implementation.
I'm still working on cleaning up the source a little before releasing it,
but was wondering if anyone had some feedback on the design as described so
far. What should be changed or implemented in order for this to be more
useful to you?
Thanks,
-Curt
--
Curt Hagenlocher
curt at hagenlocher.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080204/7fadc578/attachment.html>
More information about the Ironpython-users
mailing list