Curt, This is a great feature and was one of the first features that I investigated when I first got my hands on IP.
I see an immediate need for this feature in using data binding with Windows Forms controls. Many controls (such as DataGridView and ListView) reflect over the properties of bound objects in order to display this data dynamically with no programmer setup. Because IP types are dynamic, WinForms cannot find any properties to bind and creates an "empty" object. In order to use these features now, I must create static interfaces with the required properties in a separate assembly and then inherit that interface whenever I bind to business objects. To make using these UI controls easier, it would be great if property statements could be turned into static properties either automatically or via a flag. It seems that IP already matches properties to the correct static getter/setter as defined in the interfaces so this should be a reasonable request. This staticization would remove the need for the separate static interface. Another situation in which this would be really helpful--although less critical--involves situations where I want to use a static tool on an IP assembly (for example, I want to use NUnit to test my IP classes). I say that this is not critical as a lot of tools already have Python-specific versions available--PyUnit is a good example. Finally, would there be a way to simplify programmer work by providing "standard" static creators that are turned on and off at a high level? For example, programmers could use a "compiler" switch to turn all functions into "void func(object, . . .)" and "object func(obj. . . )". I see this being useful in situations such as using NUnit because all that is really needed is the proper number of arguments and the right function name (all of which are already known in Python). If things then work the way that I think they work, you could then just pass the objects into the correct comparators, and if they are the right type, then the tests will run. Otherwise, you'll get an exception. Hope that helps, Rocco ________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Curt Hagenlocher Sent: Monday, February 04, 2008 1:31 PM To: Discussion of IronPython Subject: [IronPython] Exporting Python code as an assembly 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 [EMAIL PROTECTED]
_______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com