[erlang-questions] call by value

Paulo Sérgio Almeida psa@REDACTED
Thu May 19 17:59:20 CEST 2011


On 5/19/11 4:41 PM, Ulf Wiger wrote:
> You should ignore the issue of copying. Essentially, Erlang can be viewed as using copy-on-write semantics.
>
> The key is whether the expression is evaluated or not (it is) before the function is called, and also whether the called function can modify the input parameters (it can't)*.
>
> * Unless you use unholy functions like hipe_bifs:bytearray_update/3, which of course you don't. ;-)
Unless you need to implement huge bloom filters with good performance. ;-)

Regards,
Paulo
> BR,
> Ulf W
>
> On 19 May 2011, at 17:36, Martin Dimitrov wrote:
>
>> Hi,
>>
>> How will we have to interpret this citation from "Erlang Programming" by
>> Francesco Cesarini and Simon Thompson (page 30):
>>
>> "All calls with variables in Erlang are call by value: all arguments to
>> a function call are evaluated before the body of the function is
>> evaluated. The concept of call by reference does not exist, ..."
>>
>> 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?
>>
>> Regards,
>>
>> Martin
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
> Ulf Wiger, CTO, Erlang Solutions, Ltd.
> http://erlang-solutions.com
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list