Why Does “=” Mean Assignment?
41–50 of 367 posts
Re: Why Does “=” Mean Assignment?
#42Is it really worth allowing assignment in places so weird that you also need ==? Wouldn't it be easier to use = for everything and get rid of those weird edge cases?
Although even then it's nice to use different symbols because they are different meanings. I don't like it when a word has different meanings depending on context.
Re: Why Does “=” Mean Assignment?
#43That is an assignment. There is also a math symbol that specifically designates equivalence.
Re: Why Does “=” Mean Assignment?
#44Re: Why Does “=” Mean Assignment?
#45Or perhaps <-
Re: Why Does “=” Mean Assignment?
#46Bcpl still exists in 2018?
Re: Why Does “=” Mean Assignment?
#47because in math it means assignment. y = mx+b That is an assignment. There is also a math symbol that specifically designates equivalence.
Re: Why Does “=” Mean Assignment?
#48Another interesting way to think about it is as "match". That is try to match the stuff on the right with the stuff on the left. Take Erlang for example: 1> X = 1. 1 2> X = 2. ** exception error: no match of right hand side value 2 Notice variables are immutable (not just values themselves). Once X becomes 1, it can only match with 1 after that. You might think this is silly or annoying, why not just allow reassignme…
Re: Why Does “=” Mean Assignment?
#49Re: Why Does “=” Mean Assignment?
#50Earlier quoted context omitted.
From the article: > Looking at this as a whole, = was never “the natural choice” the assignment operator. Pretty much everybody used := for assignment instead, possibly because = was so associated with equality. Nowadays most languages use = entirely because C uses it, and we can trace C using it to CPL being such a clusterfuck.
And I dispute the "pretty much everybody used" part. In fact, I think the article contradicts that opinion. Algol used it, and so did Pascal. But Pascal was only a year old [Edit: at the time the choice was made for C] - it [Pascal] hadn't set the world on fire yet (to the degree that ever did). That leaves Algol using ":=", and FORTRAN, COBOL, and Lisp not using it. That's not "pretty much everybody used".