clarification on single assignment

Martin Bjorklund mbj@REDACTED
Wed Nov 22 11:05:06 CET 2000


Ulf Wiger <etxuwig@REDACTED> wrote:
> 
> I read a paper on SAC (Single Assignment C):

[...]

> Thus, we can reuse variable names in a function and lose nothing.

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.

So, you'd need to introduce an assignment operator.  The compiler
could translate it into a match, and also generate a new variable name
each time:

  A := 1,
  A := 2

  ===>

  A_0 = 1,
  A_1 = 2

Ugly indeed!


Join the Non-Assignment Generation!


/martin



More information about the erlang-questions mailing list