Hacker News new | ask | show | jobs
by bachmeier 2108 days ago
shrug

I've used it. The overloading of the equals sign is something that has never made sense for assignment. (Seriously, it's hard to intentionally come up with dumber notation than x = x+1.) I do use -> sometimes. It's more natural to do the evaluation and then figure out where you're going to store the result (particularly when you're programming).

This is minor as these things go. Definitely not a big deal one way or the other.

1 comments

If assignment is what we are concerned about, we should introduce something like `x := x + 1`.
why `:=` and not `<-`?

The `<-` in R comes from the APL keyboard, and that glyph is an assignment in APL. It wasn't just some crazy invention from Ross & Robert or even John Chambers.

Is "x<-3" an assignment to x or a comparison of x to -3?

The same problem led early C (pre-K&R1) to change its compound assignment operators from "=op" to "op=". In early C, "x = -3" assigned the value -3 to x (as it does now), but "x=-3" meant "x = x - 3" (now written "x-=3").

Left side assignment is still used to us, from maths and most other programming languages, so it keeps things familar.

The `:=` has been in use in other langs like MySQL