forget

Chris Pressey <>
Wed May 29 08:53:36 CEST 2002


On Tue, 28 May 2002 14:59:50 -0500
James Hague <> wrote:

> >And then we'll have to stop saying "Erlang is a single assignment
> >language" (since, technically, we're making multiple assignments to an
> >'invisible' variable.)
> 
> I don't think that's the case at all.  The following two are equivalent:
> 
> Value = a(b(c())).
> 
> Value =
> 	c(),
> 	b(^)
> 	a(^).
> 
> There's no assignment in the evaluation of the right hand side of the
> expression.  It's just that the "top of the stack," so to speak, is
> being carried along.  The preprocessor could convert the latter into the
> former without using intermediate variables.

A preprocessor could convert anything to anything.  That's beside the
point.  From the point of view of the Erlang programmer, there is no
stack nor any intermediate variables -- these are things only implementers
should really have to think in terms of.  Erlang programmers should be
concerned with the language as it's presented.  Just because your two
examples are equivalent, does not mean they are not different -- ^ is a
new kind of identifier.

In a single-assignment language, by definition, each identifier takes on
one and only one binding during each function invokation, and this binding
does not change during the duration of the function invokation.  By
introducing an identifier ^ which takes on multiple bindings during a
single function invokation, we violate this principle, even though we do
not have to explicitly say "^ = ..." to make it occur.

That's not to say that I'm against it, though.  Just that I think it would
be more accurate to describe the language as 'mostly, but not entirely,
single-assignment' if it's introduced.

-Chris



More information about the erlang-questions mailing list