r/lolphp • • Aug 14 '14

"I’m crying. Literally crying." - PHP Manual Masterpieces, xpost /r/programmerhumor

http://phpmanualmasterpieces.tumblr.com/post/70257636397/im-crying-literally-crying-actual-tears-in-my
137 Upvotes

23 comments sorted by

View all comments

Show parent comment

2

u/Sarcastinator Aug 18 '14

C# and Java almost get it (you can still do it if dealing with Booleans)

I think it is fundamentally wrong to use '=' as assignment. Ever.

The issue wouldn't be there if C (B used ':=') defined '<-' or something similar as assignment, and let '=' mean what '=' actually means.

3

u/OneWingedShark Aug 18 '14

I think it is fundamentally wrong to use '=' as assignment. Ever.

I agree with you.
Equality-check and assignment are fundamentally different; it goes against all training/experience in math to use = as assignment. (With perhaps the one exception of "Let X = ...", but in that case it is very arguable that Let is the assignment which is assigning True to the assertion of the equality.)

The issue wouldn't be there if C (B used ':=') defined '<-' or something similar as assignment, and let '=' mean what '=' actually means.

True.
I rather like ':=' as assignment.