I got my feet wet in Actor Oriented Programming with a language called SALSA, which allows actors to move from one machine to another.
I was wondering if this was something that could be done using either Scala or Erlang which are two Actor oriented programming languages that have a lot more momentum behind them.
If either of these languages support this feature, would you please point me to some material that references how to implement something like this?
Well, Erlang does not (afaik) allow to move processes (at the very least, the PID is tied to the node). If you want to do that for a particular function, what you can do is start a process on another node (using the rpc:call
and a wrapper function, for example) and pass the state to it.
Of course, that works if you keep your state around and not in the process dictionary. And, of course, the PID of the new process will be different, but you can, for example, leave your existing process hanging and forward the messages to the new one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With