clarification on single assignment

Robert Virding rv@REDACTED
Thu Nov 23 10:02:19 CET 2000

James Hague <jamesh@REDACTED> writes:
>Robert Virding wrote:
>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?

Apart from scopes you would also get problems when the "assignment" is 
really a match, for example:

    X = foo(),
    X = bar(),

While it would be possible to say that the second match just rebinds X 
it would be incompatible with the matching today.  Now I don't know how 
oftern people use this matching property, indeed the compiler warns 
about it just because it is uncommon and not what is commonly wanted, 
but it would probably break code, and in a very obscure manner.

Anyway then you wouldn't get the easy access you have to old values 
"for free" as you do today. :-)

Anyway without loops it really isn't that much of a pain.


More information about the erlang-questions mailing list