[erlang-questions] Why single-assignment with non-shared state?
Cameron Kerr
ckerr@REDACTED
Sat Oct 20 13:37:01 CEST 2007
If you can only assign to a variable once, you cannot have race
conditions.
Another (possible) benefit of single assignment is that it means you
only ever need to pass a pointer to the memory. In mutable languages,
you cannot be sure that the source won't be modified, so you copy the
memory. With single assignment, it is always safe to pass a pointer,
knowing that the source cannot change. A corollary of that is that
message-passing is much faster than it if you would do it in eg. C.
Of course, this does not hold when sending to a different host, which
has a different memory space.
I would be interested in knowing if this is what Erlang does in fact do.
On 20/10/2007, at 10:50 PM, Tobias Gerdin wrote:
> Hi there,
>
> I do not understand why the single-assignment restriction exists in
> Erlang (even though I very much enjoy functional programming) given
> that processes do not share state. What is the problem with mutable
> state in a concurrent system when other processes cannot access other
> processes' state?
>
> I was hoping someone could enlighten me on this matter.
>
>
> Regards,
>
> Tobias
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
--
• Cameron Kerr • ✉ ckerr@REDACTED •
•
• Telecommunications Teaching Fellow & SysAdmin •
• ✎ http://humbledown.org/blog/ • ✆ New: 027 7175 244 •
"Technological advances are not made by sadomasochistic, cultic, tool-
worshipping pain freaks." – http://freeshells.ch/~revence/myths.txt
More information about the erlang-questions
mailing list