Although in Erlang it's closer to an equation with assignment being a side effect. `=` is the pattern matching operator.
Eshell V15.2.6 (press Ctrl+G to abort, type help(). for help)
1> X = 1.
1
2> X = X.
1
3> 1 = X.
1
4> X = 2.
** exception error: no match of right hand side value 2
5>
That's exactly right. Looking at the Assignment Operator Wiki page, it's also clear where these notations come from.
I think an easy way to look at it, for someone coming from a math background, is to think of programming lines as instructions, instead of statements. x=x+1 can be then read as "let x be x+1", and that's it.
It’s not really such a different meaning, it’s just shorthand for something like:
X’ = X + 1
DELETE X
X = X’
Even if you treat it as “storing a value in a slot”, a comprehensive model of the operation needs to model the fact that the value of the slot changes over time. So another way to look at it would be:
X_t1 = X_t0 + 1
…except that “X” is shorthand for “the latest binding that uses this name.”
X := X + 1 is perhaps less confusing, even if meaning the same thing.