|
|
|
|
|
by quaunaut
926 days ago
|
|
That's just standard erlang/elixir- because all values are immutable, when a new anonymous function is defined it copies the current value of the external variables into it. You can do it right now even without Flame, just by opening two Elixir nodes, then it's as simple as ```elixir iex(first_node@localhost)> name = "Santa" iex(first_node@localhost)> Node.spawn_link(:other_node@localhost, fn -> IO.puts "Hello #{name}" end) Hello Santa #PID<1337.42.0> ``` Note that while the string interpolation and `IO.puts` was run on `other_node@localhost`, it still did stdout from the first node- this is because it was the one that called `Node.spawn_link`, making it the 'group leader'. Outside of which stdout it went to, all the work was done in the other node. |
|