[erlang-questions] call by value

Richard O'Keefe ok@REDACTED
Fri May 20 11:44:03 CEST 2011


On 20/05/2011, at 7:07 AM, Martin Dimitrov wrote:

> Thanks for the explanation. Now I am glad I asked that question.
> 
> I had always thought of call-by-value as the actual act of copying the
> value which now I understand it might be or might not be as in the case
> with Erlang.

It's precisely the same in Java, Javascript, C#, Eiffel, Lisp, you name it
(except for Pascal).

PASSING a value is a constant time operation;
for small integers this might be equivalent to copying,
but for "values" that are (references to) linked structures,
no copying is done.

The way Java talks about it, if you pass an array to a method,
the *object reference* is the value that is passed, and this happens
to point to a shared mutable object which is *not* copied.




More information about the erlang-questions mailing list