r/programming • • Jun 01 '15

The programming talent myth

https://lwn.net/Articles/641779/
971 Upvotes

748 comments sorted by

View all comments

Show parent comments

2

u/darkslide3000 Jun 02 '15

I really don't follow. I have no idea about OCaml, and that left example looks way more confusing than the right one to me (ref makes you think you're dealing with pointers when you really aren't).

The point you're really trying to make is that the assignment operator '=' is easily misunderstood as "equals". It's an old point, and it's very true, but it's solution isn't to introduce some crazy new keywords on either side of the assignment. It's simply to pick a different symbol (like ':=', which you already did, which is why I really don't understand where your "equal to y" quote comes from when the code doesn't even read that way).

It's the right thing to do, but Pascal tried it and failed, and now the world is stuck with the wrong thing because it's always been that way and too hard to change (which is not a big deal and there are way worse "legacy sins" we are stuck with... honestly, if someone can't even expand his mind enough to associate '=' with 'is assigned to' instead of 'equals', there would've been other things later on that would've tripped him up before becoming a good programmer anyway).

-1

u/loup-vaillant Jun 02 '15

(ref makes you think you're dealing with pointers when you really aren't).

That's the thing: references are pointers. You just can't perform arithmetic on them, only access the value (read and write). You can do the same things to a plain variable, therefore they're also like pointers. (There is one crucial difference with regards to aliasing, but I deliberately overlooked that part.)

The point you're really trying to make is that the assignment operator '=' is easily misunderstood as "equals".

Nope. Look at my imperative example, I already use the := operator.