You can just create the function name and do nothing with it. In Cpython i would use meta classes but idk if they are in IronPython
On Thu, Dec 4, 2008 at 11:13 PM, Jeff Slutter <[EMAIL PROTECTED]>wrote: > I'm writing an application that I want to provide runtime scripting via > IronPython for. This application loads "plug-ins" from assemblies to add > functionality. > > Each plug-in is a class with, for the sake of simplicity, a "Do" function. > > What I'm trying to figure out is that if I have a class like: > > class AddNumbers > { > public string Do( params object[] args ) > { > ..check args.. > ..add the two arguments.. > ..return the result as a string.. > } > } > > > That I could call it from IronPython like: > > AddNumbers( 3, 4 ) > > When that happens a new instance of the AddNumbers class is created, the > arguments are then passed to the Do member function, the result is > returned back to Python. > > This may seem like a weird way for scripting. But, doing it this way I > can do some other important things, such as keeping a history of the > commands. If, along with Do, the commands have Undo and Redo functions, > then I can keep the instances of the commands stored and should the user > need to undo their command, I can internally run the Undo function. > > Any ideas on how I should approach this? I don't mind having to do a > good chunk of backend work so that to add new command plugins, I just > have to write a class with a Do function and possibly provide some > Attributes if necessary. If I have to make some concessions that is > fine, but I need to stick with the concept of creating an instance of a > class and executing a function to perform the operation. > > I assume I'm either going to have to generate some sort of thunk > function (I have no idea where to start) or provide some sort of > 'command runner' that really gets called. > > Any help or guidance is mighty appreciated, > Jeff > _______________________________________________ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- http://www.astorandblack.com/ http://www.thewatcherys.com/
_______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com