I’m working on an external DSL in F#. The language must allow parallel loops:
start 5 times
operation
This starts operation asynchronously 5 times and continues with the execution. However, things are a bit complicated because operation uses a Thread-unsafe library (no way to avoid this), thus I suppose each iteration must be started in a separate process.
Assuming this is the only way around the thread-unsafety problem, How can I start a process and pass the execution subtree (a distriminated union at this point) that must be executed?
I’m thinking WCF named pipes, but would like to hear if there are alternatives (WCF means starting the process, waiting for a call-back (keeping track of it) and returning the subtree -not very functonal-friendly code but maybe I’m wrong).
Also, performance is not really important in this case.
EDIT:
Turns out I don’t need any communication after the process has started. I’m tempted to simply pass the expression string as a process startup parameter and let him parse/execute it. I’m still interested in alternatives, but I suppose it doesn’t get any simpler than that.
Running each operation in a separate AppDomain–if possible–would be simpler than IPC.