On 27/04/2018 08:38, Greg Ewing wrote:
How would you complete the following sentence? "The ':=' symbol is a much better symbol for assignment than '=', because..."
... users new to programming but with a scientific background expect '=' to be a statement of an algebraic relationship between mathematical quantities, not an instruction to the machine to do something. That's easy to answer. (I can remember this particular light bulb moment in a fellow student, who had been using a different name in every assignment statement, and had found loops impossible to understand.) Also it frees up '=' to be used with something like its expected meaning in conditional statements, without making parsing hard/impossible. There are arguments the other way, like brevity and familiarity to other constituencies. But I feel we all know this. Having chosen to go the '=', '==' route, the cost is large to change, especially to get the other half of the benefit ('=' as a predicate). So I think the question might be who is it better for and how much do we care. And whether the days are gone when anyone learns algebra before programming. I speculate this all goes back to some pre-iteration version of FORmula TRANslation, where to its inventors '=' was definition and these really were "statements" in the normal sense of stating a truth. Jeff Allen