forget

Robert Virding <>
Wed May 29 23:02:36 CEST 2002


> >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.  In Forth this would be:
> 
> c b a Value !
> 
> which I have to admit is prettier.

There are a couple of problems here.  The first one someone has already
mentioned, that while Forth has an explicit stack Erlang (the language)
doesn't, it has variables. The second one is that I personally find that
I seldom have this type of code, it is usually something like:

f(A0, B0, C0) ->
    {A1,B1,C1} = a(A0, B0, C0),
    {A2,B2,C2} = b(A1, B1, C1),
    ... .

so an ^ would be of very little use.

Robert
 




More information about the erlang-questions mailing list