How does the memory management of variables work in Elixir and Erlang?
Is it pass-by-reference? Pass-by-value? Something else?
How does the memory management of variables work in Elixir and Erlang?
Is it pass-by-reference? Pass-by-value? Something else?
Elixir always passes COPIES of the variable's value; Elixir never passes variables by reference. Passing by reference is impossible in Elixir even if you wanted to (unless I'm woefully mistaken). This strategy is partly what makes Elixir particularly well suited for dealing with issues of concurrency.