Why Does "=" Mean Aassignment?

6 years ago
ian $Q__4tgrnLN

https://www.hillelwayne.com/post/equals-as-assignment/

A common FP critique of imperative programming goes like this: “How can a = a + 1? That’s like saying 1 = 2. Mutable assignment makes no sense.” This is a notation mismatch: “equals” should mean “equality”, when it really means “assign”. I agree with this criticism and think it’s bad notation. But I also know some languages don’t write a = a + 1, instead writing a := a + 1. Why isn’t that the norm?

The usual answer is “because of C”. But that’s just passing the buck: why does C do it that way? Let’s find out!