3 ms·
"=" is still equality. It's not an operator that compares two values. It's an operator that defines the left hand to be equal to the right hand. I feel like "="
by rowanG077 6y ago
"=" is still equality. It's not an operator that compares two values. It's an operator that defines the left hand to be equal to the right hand. I feel like "=" for assignment is fine. For boolean comparison something like "=?" seems most clear, like asking a question whether the left and right hand side are equal.
- scarmig 6y agoIn imperative languages, assignment has a side effect of making the LHS equal to the RHS. But it's still different from equality, since variables can be reassigned E.g. a = 2 a = 3 2 = 3 //what??? Assignment is fundamentally part of the language execution model, which is entirely apart from anything related to mathematical equality. Even in languages where you can't rebind a variable name, it's still weird to use = as assignment, since it would have such different behavior than seemingly analogous operators like > and <.