12 ms·
Messages between Erlang processes are simply valid Erlang terms. That is, they can be lists, tuples, integers, atoms, other pids (process identifiiers), strings
by weatherlight 4y ago
Messages between Erlang processes are simply valid Erlang terms. That is, they can be lists, tuples, integers, atoms, other pids (process identifiiers), strings, and so on.
However, Erlang and Elixir's AST is also composed of valid Erlang terms, so as I understand. you can send entire Erlang/Elixir programs as messages.
To answer your question, Yes, it is possible, but there is no "Move process to node" call. However, if the process is built with a feature for migration, you can certainly do it by sending the function of the process and its state to another node and arrange for a spawn there. To get the identity of the process right, you will need to use either the global process registry or gproc, as the process will change pid.
There are other considerations as well: The process might be using an ETS table whose data are not present on the other node, or it may have stored stuff in the process dictionary (state from the random module comes to mind)