|
|
|
|
|
by jmillikin
5557 days ago
|
|
What definition does "assignment" have other than "a binding of a name to a definition"? Keep in mind that there are at least three popular definitions of the = operator: 1. In C or C++, = handles assignment and mutation (no re-assignment): int x = 1; /* assignment */
x = 2; /* mutation */
2. In Python, = handles assignment and re-assignment (no mutation): x = [1] # assignment
x = [2] # re-assignment
3. In Haskell, = handles assignment (no re-assignment or mutation) let x = 1 in
Just because Haskell's = operator does not behave like C's = operator is no reason to claim Haskell does not support assignment. In fact, that is the only thing Haskell's = operator supports. |
|
To me, the statement "programming without assignment" implies programming without making multiple assignments to the same name - mutation or re-assignment. I don't know if the programming language community has agreed-upon semantics for the word "assignment," but to me, it implies re-assignment and mutation. What you call "assignment" I think of as binding - that is, the lvalue gets bound to the rvalue.