clarification on single assignment
Ulf Wiger
etxuwig@REDACTED
Wed Nov 22 11:17:46 CET 2000
On Wed, 22 Nov 2000, Martin Bjorklund wrote:
>But Erlang doesn't even have assignment in the first place! '=' means
>match, which binds unbound variables. For example,
> A = 1,
> A = 2 % badmatch, or reassign?
>
>match is of course more powerful than assignment.
No argument from me, except that in the Erlang white paper, and in
many other places, Erlang is described as a single-assignment
language:
"In contrast to, for example C variables, Erlang variables can only be
assigned once - when a variable has been bound to a value, we cannot
bind it to a new value."
Following your line of reasoning, we should change this do something
like:
"In contrast to, for example C, Erlang does not have an assignment
operator - variables are automatically bound via pattern matching.
When a variable has been bound to a value, we cannot bind it to a new
value."
Or is that too confusing?
/Uffe (who doesn't really need or want an assignment operator)
--
Ulf Wiger tfn: +46 8 719 81 95
Senior System Architect mob: +46 70 519 81 95
Strategic Product & System Management ATM Multiservice Networks
Data Backbone & Optical Services Division Ericsson Telecom AB
More information about the erlang-questions
mailing list