Live data from Hacker News

Why Does “=” Mean Assignment?

hillelwayne.com

1–10 of 367 posts

Re: Why Does “=” Mean Assignment?

#2
The '=' sign is used because after that statement the variable will indeed have equality with the r-value.

Coincidentally in async languages like Verilog there is a another assignment operator '<=' which means that the variable won't take the new value until the next clock cycle (or more explicitly the next evaluation of the process block). '=' exists also and has the same meaning as with traditional languages.

Re: Why Does “=” Mean Assignment?

#4
Because programming languages are typically designed for the tiny group of existing programmers than the much larger group of future programmers. The same reason unnecessary tokens exist, and 'drop' means delete in databases. It's entirely cultural.

Re: Why Does “=” Mean Assignment?

#5
Because K&R had terrible keyboards so they abbreviated everything as much as possible.

Traditionally := was used for assignment, which makes sense since it is an asymmetric symbol for an asymmetric operation.

Re: Why Does “=” Mean Assignment?

#7
post #4

Because programming languages are typically designed for the tiny group of existing programmers than the much larger group of future programmers. The same reason unnecessary tokens exist, and 'drop' means delete in databases. It's entirely cultural.

Technically, DROP is used because DELETE is taken by something that deletes rows and using DELETE for tables and rows is a bit scary so you get DROP. I suspect quite a lot of naming happens that way.

Re: Why Does “=” Mean Assignment?

#8
About once every year I have a brain fart on a sleepy morning and confuse myself by using = for comparitors and or == for assignment... shortly followed by "Nnarhh".

[edit]

:P LOL at downvotes, HN is no place for silly annecdotes "this is serious things we dooo".

Re: Why Does “=” Mean Assignment?

#10
post #5

Because K&R had terrible keyboards so they abbreviated everything as much as possible. Traditionally := was used for assignment, which makes sense since it is an asymmetric symbol for an asymmetric operation.

There’s also <-, most commonly seen in R but draws it’s heritage from the APL keyboard
Post reply on HN