could you stop snipping so greedily! I had to back up twenty messages
to find the context.
Sorry!
Because he pronounces it as "x is not equal to y", and the subject of
that sentence is "x". "x" is the actor, the variable that is acting. "y"
is part of the prepositional phrase, it is static.
This is C we're discussing, not English. It is folly to pretend that
the
rules of English apply to C.
It hasn't been, but if you can find a counterexample to the claim that
people generally distinguish between topic and comment, I'd love to see it.
to be honest I just don't see this in normal english. People
describing events often intersperse the interpreation of events or
motivation with what happened.
That has absolutely nothing to do with the distinction between topic and
comment. [...]
When someone says "the bear ate Bob", the bear is the topic, "ate bob" is
the comment.
this is a definition of "comment" I hadn't heard before. And an odd
one. Is it a technical term from linguistics or something?
Yes. And one which someone had recently pointed out in-thread.
So "topic" is what I'd call "subject" and "comment" is some sort of
"action"? A way to try and link psychology with OO programming?
Comment is what you're saying about the subject. Not really "action" -- more
"information". "The ball is red" is not telling you about something the ball
*does*, but giving you information about its qualities.
And there's a big difference between "The ball is red" and "The red thing is a
ball" in English.
And how does this apply to
if (3 == thingy)
do_something_with (thingy);
In
x == y
It is most often the case that x is topic, y is comment. Which is to say,
we are comparing a thing we are interested (x) in to a value we aren't
particularly expecting to change (y) but which would tell us about it.
In general, if I have a loop:
while (x != y) {
}
two things are true:
1. I almost certainly expect x to change during the loop, and y not to
change during the loop. It's not a guarantee, but if you check all the
code out there, in books, in real world code, etcetera, you'll find that
it's true nearly all the time. The only exceptions are people writing
it "backwards" and cases where both are subject to change.
2. A future reader of my code is, as a result, more likely than not to
at least initially make that assumption.
Having that assumption change if, and only if, y is a constant, is extremely
surprising.
Now, if you ALWAYS wrote it the other way -- if you always wrote "max > i"
rather than "i < max", etcetera -- people would probably find it less
confusing. It's that the natural order is consistently used except in
one specialized case that makes it so surprising.
I'm very dubious about any argument that uses (cod?) psychology to
justify language choice (that way lies Perl!). Human beings (and, I
think programmers) are very flexible in what they find lingusitically
acceptable. I don't like 3 == thingy but I don't think it relates to
my cortextual wiring.
I am in general skeptical of them, but the strength of the topic/comment
rule is manifest, and the large number of people who find it confusing
suggests that it really *is* confusing.
I would guess that, had early code not developed a convention, we might not
find it so confusing, but once the convention was established... Going
against it is like driving on the other side of the road because you've
become convinced that it is a technically superior choice.
-s