clarification on single assignment

James Hague jamesh@REDACTED
Wed Nov 22 20:42:43 CET 2000

Robert Virding wrote:

>No, it will not work in Erlang.  The trouble is that Erlang has no
>variable scope and in SAC they relied on this to be able to call it
>single-assignment. So in SAC (whatever the syntax is):
>    x = <expr1>;
>    <expr2>;
>    x = <expr3>;
>    <expr4>;
>would have the same semantics as
>    let x = <expr1> in
>	<expr2>
>	let x = <expr3> in
>         <expr4>
>This works because of variable scoping.  This also means that
>there are no problems with assigning variables in multiple

Forgetting about matching vs. assignment, wouldn't just defining "x =
<expr1>;" as having the same semantics as "let x = <expr1> in ..." be
enough?  In effect, each assignment starts a new variable scope.  When does
this fall down?


More information about the erlang-questions mailing list