Re: Avoiding == and = mixup in if statements
Re: Avoiding == and = mixup in if statements
- Subject: Re: Avoiding == and = mixup in if statements
- From: Wade Tregaskis <email@hidden>
- Date: Sun, 23 May 2004 23:44:01 +1000
This response is surreal to me, speaking as someone who's comfortable
with a few dozen programming languages.
That sounds a bit optimistic.. :)
I don't think it's reasonable to suggest that someone is going to
momentarily forget which form of an operator they should use, because
the languages are distinct enough that every bit of typing is going to
be reinforcing that you're in language X instead of Q, F or K. It's
subconscious, but it's real.
I disagree. You're implicitly assuming one uses the language "enough"
to be reminded of it's conventions and operators. I frequently jump
back into the odd language I haven't used for ages, and I hate having
to be reminded the hard way which particular school of thought it's
designers were from. My subconscious apparently isn't as astute as
yours, but I daresay I'm not the only one. And I've been programming
for most of my short, impressionable life, so I imagine if anyone were
going to develop instinctive syntactic recall, I would have.
Having said that, and getting back to the original topic, a good way to
prevent assigning something where you mean to compare it is to always
place constants on the left hand side. It's back the front for a lot
of people, but really it's just a different school of thought, and
ultimately you get used to it, and avoid those few extra errors.
Maybe, also, it'll help you learn another [spoken] language faster, one
where the grammar is the reverse of what you're used to*. ;)
Wade Tregaskis (aim: wadetregaskis)
-- Sed quis custodiet ipsos custodes?
* = Actual results may vary, no guarantee's provided. ;)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.