From: Malcolm McLean on
Nick Keighley wrote:
> This is C we're discussing, not English. It is folly to pretend that
> the rules of English apply to C.
>
The keywords are English, with meanings related to their everyday non-
computer usage. (The exception maybe is "static").
In English we tend to say "x + 5" rather than "5 + x", "draw a point
at x, y" rather than "draw at y, x", 1/x rather than x^-1. It's all
purely conventional and without mathematical meaning, but it is the
way people talk. When computer code reflects those conventions it is
easy to read.
x equals 5 rather than 5 equals x is a particularly strong convention.
From: Seebs on
On 2010-03-09, Nick Keighley <nick_keighley_nospam(a)hotmail.com> wrote:
> 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.

> On 8 Mar, 20:07, Seebs <usenet-nos...(a)seebs.net> wrote:
>> On 2010-03-08, Nick Keighley <nick_keighley_nos...(a)hotmail.com> wrote:
>> > On 7 Mar, 22:14, Seebs <usenet-nos...(a)seebs.net> wrote:
>> >> 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.

>> So far as I know, everyone makes this distinction. �While it's not a hard and
>> fast rule, it's nearly always the case that the focus of discussion is the
>> topic of the sentence, not the comment. �Thus, "the bear ate Bob" is a
>> statement by someone who is trying to talk about the bear, while "Bob was
>> eaten by a bear" is a statement by someone who is trying to talk about Bob.
>>
>> They don't have quite the same semantics. �One has the implication "and we
>> care about what the bear did", the other has the implication "and we care
>> about what happened to Bob".

> 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
--
Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: Rainer Weikusat on
Keith Thompson <kst-u(a)mib.org> writes:
> Rainer Weikusat <rweikusat(a)mssgmbh.com> writes:
> [...]
>> If you desire to address the point I was trying to make, feel free to
>> do so. These sideline battles are useless exercises.
>
> I was trying to address the point that (I thought) you were trying
> to make. Perhaps if you could restate the point more clearly,
> I could try again to respond to it.

I already restated my point in a somewhat more condensed way,

,----
| It is completely obvious from the difference of meaning of the code
| which was written down vs the part of the code which actually performs
| some sensible function. Spelled out, the condition means (assuming
| that x is also a variable of type size_t)
|
| x = i, i = i - 1, x != 0
|
| Since the loop is only supposed to run until the counter has reached
| the value zero, decrementing an i whose value is zero when the
| condition is checked for the last time is just a pointless contortion.
`----

You have again ignored this completely. Further, I posted an
explanation of the difference between this
postincrement-where-it-isn't-appropriate issue and you for loop:

,----
| since none of the increments which are supposed to be performed by
| the code quoted above are technically useless, meaning, what I
| called 'overstepping the loop counter' does not occur here.
`----

Because the test is basically while (i < N), i needs to be incremented
until i == N, while in order to test i != 0, no post-decrement down to
(unsigned)-1 needs to be performed. You still claim that both would be
identical while they are clearly not identical and anyone with sufficient
knowledge in C to understand the code at all can be expected to
understand the difference. Lastly, I specifically wrote (in the first
text whose content you have chosen to ignore) that I wouldn't be
writing about "optimizations issues", yet, you are trying to drag me
into a discussion of exactly that in the other posting.

Whatever your motivation for acting in this way might be, for as long
as you are basically attaching unrelated statements to random parts of
heavily redacted variants of texts I originally wrote, any attempt at
a 'discussion' is a waste of bandwidth.
From: Seebs on
On 2010-03-09, Rainer Weikusat <rweikusat(a)mssgmbh.com> wrote:
> You have again ignored this completely.

I looked at it a bit, and it didn't seem to say much.

> Further, I posted an
> explanation of the difference between this
> postincrement-where-it-isn't-appropriate issue and you for loop:

> ,----
>| since none of the increments which are supposed to be performed by
>| the code quoted above are technically useless, meaning, what I
>| called 'overstepping the loop counter' does not occur here.
> `----

> Because the test is basically while (i < N), i needs to be incremented
> until i == N, while in order to test i != 0, no post-decrement down to
> (unsigned)-1 needs to be performed. You still claim that both would be
> identical while they are clearly not identical and anyone with sufficient
> knowledge in C to understand the code at all can be expected to
> understand the difference.

I think we've gotten to a point where we need a couple of code fragments
in view.

Could you show us the two tests you're comparing, which you say are not
identical, and which someone else apparently said were identical? Ideally,
a short loop using each to, say, print the numbers from 9 to 0 or something
like that.

-s
--
Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: Rainer Weikusat on
Seebs <usenet-nospam(a)seebs.net> writes:
> On 2010-03-09, Rainer Weikusat <rweikusat(a)mssgmbh.com> wrote:
>> You have again ignored this completely.
>
> I looked at it a bit, and it didn't seem to say much.

Cutting something away from a text and than making a summary statement
about what had been cut away is a standard tactic.
First  |  Prev  |  Next  |  Last
Pages: 51 52 53 54 55 56 57 58 59 60 61 62 63
Prev: integer
Next: shared memory question