[erlang-questions] call by value

Matthew Sackman <>
Thu May 19 17:40:40 CEST 2011


On Thu, May 19, 2011 at 06:36:02PM +0300, Martin Dimitrov wrote:
> I know that variables are not copied when making a function call and are
> copied when sending messages to processes. So why do the authors say all
> calls are call by value? Aren't the function calls actually call by
> reference?

Well I think there is a difference of interpretation of the terminology
based on whether you're in C world or functional world. To me, they're
more talking about laziness: Erlang is strict and as such expressions in
arguments to function calls are reduced to terms before the function is
invoked. I'm not sure that's exactly the same as call by value, but
given the idempotency of data structures in functional languages
generally, it's not clear that a C-style interpretation of call-by-value
or call-by-reference has any meaning for functional languages.

Matthew



More information about the erlang-questions mailing list