45 ms·
When I read it in my head, I read it as "let". As in "x = 5" -> "let x be 5".
by llimllib 15y ago
When I read it in my head, I read it as "let". As in "x = 5" -> "let x be 5".
- pjscott 15y agoIn my head, I reserve the word "let" for immutable bindings. Or at least local bindings that people probably aren't going to mutate. I read it as "x equals five". So, between three of us, we saw that simple line of code in three different ways. I wonder what other people see in more complicated code.
- jcampbell1 15y agoThe point is that if you pronounce if(x=5) and if(x==5) both as "if x equals 5", then you are making things confusing for students. You as the teacher are saying the exact same words, but mean two completely different things. Kahn made this mistake and there are student comments showing the confusion. Not correctly understanding assignment is one of the biggest failure points for beginners learning programming. The '=' operator has little relation to '=' in any form the students have encountered before. It means something like "evaluate the shit on the right hand side, and store it in a variable with the name on the left hand side". That meaning is not really even close to the meaning of the english word "equals". You can personally call it whatever you want, but if you want to be a good teacher to beginning programmers, then you don't call both = and == the same thing. "x gets 5", "set x to 5" or "x is now 5" are all acceptable, but "x equals 5" is not acceptable for teaching purposes.
- loup-vaillant 15y agoI note that the biggest mistake probably comes from C itself. If only it had chosen for assignment a syntax such as : x <- 5; It would be more clear that "the shit on the right" goes to that garbage on the left. But no, they had to use the `=` sign, as if saving one character where more important than not changing the meaning of one of the most used sign of all mathematics. And now nearly all popular language is making the same damn mistake.
- llimllib 15y agoThe only thing I liked about PL/SQL back in the day was its use of := for assignment and = for equivalence.
- pjscott 15y agoI pronounce "==" as "equalsequals", sort of slurring the two words together for speed, so they sound like all one word. This is consistent with the way I treat the bitwise-versus-boolean operator confusion, e.g. "&" is "and" while "&&" is "andand". I agree with your main point, though, that failure to understand assignment is one of the biggest failure points for beginners. What programmers need to be able to do is trace through the execution of a program in their head, thinking "once this statement executes, the state will change in so-and-such way." If I had to teach introductory programming again, I would focus more on having people fiddle around with variables in a REPL, just to get a feel for that sort of thing.