It's not possible at the moment at the moment, you can get a similar effect using the codeDOM available in FSharp.Compiler.CodeDom.dll

Cheers,

Robert

By on 10/13/2008 6:19 AM ()

Hi,

you could run fsi.exe as a background process, connecting to its stdin / stdout. Take a look here or here for an example implementation.

If you had more time you could take a look at fsi.fs in the distribution and perhaps incorporate the techniques demonstrated into your own application.

Robert - do you think it's possible to replicate the REPL behaviour of fsi.exe with CodeDOM? Wouldn't recompiling at every line entry break the state of the application? I'm interested in any ideas in this area.

regards,

Danny

By on 10/13/2008 12:41 PM ()

Hi Danny,

It depends what your trying to achieve. Roughtly speaking the codeDOM and fsi do the same thing, take some code as text and compile it to a dll and then load and execute this. I think they use slightly different techniques to achieve this, the codeDOM invokes the command line compiler, while fsi creates the dll directly in memory (I think), but this is unimportant - an implementation detail. What fsi does that's different is keep a dictionary of top level identifiers and their values and ensure that they are available to future code snippets. It would be quite difficult to do a hand rolled version of this using codeDOM.

However quite often when inculding scripting in your application it's not that important for people to be able interact with there old code definitions, more often than not you they just want to run scripts against objects/modules that exist in the application. It's pretty staight forward to use codeDOM to achieve this, I have an created an ant colony simulation that uses this apporach:

[link:code.google.com]

Cheers,
Rob

By on 10/13/2008 10:27 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper