There is currently no such api, but you can pretty easily do something similar in a couple of steps: -
1) Use the F # CodeDom (FSharp.Compiler.CodeDom.dll) available in PowerPack to dynamically compile your script. The power supply contains apis to compile a single file and allows you to add links to your current application, thereby providing script access to the classes, properties and methods of the host application.
2) At the end of the compilation phase, you should have a dynamic assembly in memory. Then you can use reflection to create a dynamic instance of the object from your script and execute it.
Robert
source share