Fri 13 Mar 2009
In Erlang, single assignment is like algebra…
When I went to school, my math teacher said, “If there’s an X in several different parts in the same equation, then all the Xs mean the same thing.” That’s how we can solve equations: if we know that X+Y=10 and X-Y=2, then X will be 6 and Y will be 4 in both equations.
But when I learned my first programming language, we were shown stuff like this:
X = X + 1Everyone protested, saying “you can’t do that!”. But the teacher said we were wrong, and we had to unlearn what we learned in math class. X isn’t a math variable: it’s like a pigeon hole/little box…
In Erlang, variables are just like they are in math. When you associate a value with a variable, you’re making an assertion - a statement of fact. This variable has that value. And that’s that.
In “Armstrong, Joe; Programming Erlang; The Pragmatic Programmers; 2007“
Tags:curiosity, erlang, variables

March 13th, 2009 at 10:26 am
Então as variáveis são constantes?
March 13th, 2009 at 11:42 am
nao sabia que havia portugueses interessados em Erlang
eh uma linguagem que vale apena e nos dias que correm tem-se demonstrado ainda mais importante devido a sua escalabilidade brutal!
here here for Erlang!
March 13th, 2009 at 12:14 pm
Edson,
Depois de bounded, sim, não podes alterar. Não deixa de ser uma variavel. Foi o primeiro conceito de variavel q aprendeste, la no 6º ou 7º ano..
fancisg,
O tarpipe.com é um projecto feito por portugueses em Erlang. O SAPO tb usa Erlang (messenger). E concerteza que haverá muitos mais escondidos por aí fora..