Possibly better loop construct, also labels+goto important and on the fly compiler idea.

R

rusi

Rusi said:


Yes, I read those instructions and found them fairly opaque. If you want to
instruct "children" (odd that I find myself categorized that way on a CS
forum, but whatever) then you use pictures.

The children is intended almost literally:
GG claims that the python list (or its version thereof) has 21447 'members'.
I am willing to bet that the average age of the 21447 humans whose records are in google's dbms is between half and one-third of those that use usenet channels.

I am speaking a bit legalistically because just as statisticians will argue about what 'average' (or mean) means, likewise we could argue about what a 'member' means:
- someone who joins but does not post
- someone who joins and does not even read
- someone who posts frequently. [What's the frequency threshold?]

And which is why I quoted the passage from mathsemantics in the other thread (repeated below). So all we can really infer is that the table in some GG database contains 21447 records


------------
I 1980 I was one passenger, ten passengers, eighteen passengers, thirty-six passengers, forty-two passengers, fifty-five passengers, seventy-two passengers and ninety-four passengers. Each of these statements is true.
-----------
.... explanation...
-----------
I was one passenger in the sense that I was a person who traveled by air in that year.
I was eighteen passengers in the sense that I made eighteen round trips.
I was forty-two passengers in the sense that on forty-two different occasions I entered and exited the system of a different carrier.
I was seventy-two passengers in the sense that on seventy-two occasions I was on board an aircraft when it took off from one place and landed at another.
I was ninety-four passengers in the sense that I made ninety-four separate entrances and exits from airport terminal buildings.
 
D

Dennis Lee Bieber

If someone's editing that page, it'd be nice to also ask people to
chop their lines short - most newsgroup and mail clients hard-wrap to
80 characters, but GG posts invariably come through with one-line
paragraphs. It's annoying when you try to quote the text, and several
online archives look ugly when the lines are too long.

And I think it all comes to the same basis as the infernal double-space
quotes...

{Hypothesis based on black-box observation} GG is using HTML for
formatting internally, so what it displays as a nicely wrapped paragraph
goes out to Usenet/MailingList as a single long line -- the <p></p> becomes
a pair of line-ending characters as seen by NNTP clients (a pair to put a
blank line between /paragraphs/). In the other direction, properly
formatted (<80character) lines are being wrapped by <p></p> tags on input
to GG -- each of our display lines becoming a single paragraph on GG. Now
when quoted and sent back out, these 'paragraphs' get the double-space
treatment.
 
R

rurpy

If someone's editing that page, it'd be nice to also ask people to
chop their lines short - most newsgroup and mail clients hard-wrap to
80 characters, but GG posts invariably come through with one-line
paragraphs. It's annoying when you try to quote the text, and several
online archives look ugly when the lines are too long.

That describes my personal preferences too but...

I know people who complain about manually wrapped lines. When you
widen the window they don't expand to fill the width, and when you
narrow the window they wrap and create this awful ragged effect.

Long lines wrapped by the client reader seem to be pretty common
these days, not just from GG but from many sources although they
remain a minority of messages in c.l.p.

Further, although I've commonly seen complaints about top-posting
or occasionally excessive untrimmed context or html, I don't recall
seeing any complaints about long lines. Rusi posts here frequently
with long lines and I've not seen any complaints related to that.

I seems to me unfair to demand different standards from GG users
than others even if such posts are more common from GG.

Maybe there should be a c.l.p etiquette page somewhere applicable
to all posters.
 
R

rurpy

One more 'to-be-removed' from that page is the bit about new and old GG at the end. It used to work for a while. Now google has completely removed the 'old interface' (at least to the best of my knowledge).

I updated the page, hopefully it's an improvement?
 
B

Bernhard Schornak

Skybuck Flying wrote:

Because it's logical.


What is logical?

If the exit condition was placed on the top, the loop would exit immediatly.


This might be the programmer's intention?

Instead the desired behaviour might be to execute the code inside the loop first and then exit.


It might ... but it might be something very different, too.

Let us assume a function with variable iteration count for its loop, where the
count is passed as parameter. If the loop body always was executed completely
before the final conditional test, we had to check at least the iteration count to avoid crashes if the
iteration count is used as an array index, someone passed a negative number or
zero. Moreover, we had to restore all data manipulated by instructions inside
the loop body if we only wanted to alter data whenever the final condition was
met.

Thus seperating logic into enter and exit conditions makes sense.


No. It introduces tons of -avoidable- extra cycles, but nothing of true value.
If exit code always was placed at the bottom, and we have a loop with variable
iterations passed as one of the function's input parameters, we had to reverse
all manipulations applied within the loop, if the exit conditions were not met
at the end of the first iteration. Moreover, every erroneously passed negative
iteration count caused a crash if the passed count was used as an array index.
Hence, we had to insert input parameter tests prior to the first execution of
the loop, adding more misprediction penalties.

To get a picture: Each misprediction penalty costs an absolute minimum of ~ 20
clock cycles on recent machines. It surely is not zher best idea to add a lot
of mispredictions with the (questionable) intention to force other programmers
to obey your universal "Condition checks belong to the bottom!" law.

As assembler programmers, we can write the fastest possible code without being
bound to counter-productive rules. Compiler developers who declare conventions
just to force programmer to use delay mechanisms like "condition checks belong
to the bottom!" are a dangerous species. With compilers like that, it is quite
obvious why software became slower and slower while processor power is growing
from one hardware generation to the next.


BTW: I placed label 0 at the wrong place. The proper loop should look like this:

func:...
...
0:dec rcx
jbe 1f
...
some
code
to
perform
...
jmp 0b

p2align 5,,31
1:continue
with
something
else
...


Greetings from Augsburg

Bernhard Schornak
 
B

Bernhard Schornak

Due to unknown "improvements", SeaMonkey's built-in news editor meanwhile ignores
saved changes and sends long deleted text parts rather than thwe last seen text -
"What you See Is _Not_ What You Get"...

This is the real reply to Skybuck's posting. Please ignore the mixture of deleted
text parts, older and newer text posted at 10:58 h. Unfortunately, the option to
remove messages from the server became the victim of another "improvement", so it
is impossible for me to delete the other post.

Bernhard Schornak



Skybuck Flying wrote:

Because it's logical.


What is logical?

If the exit condition was placed on the top, the loop would exit immediatly.


This might be the programmer's intention?

Instead the desired behaviour might be to execute the code inside the loop first and then exit.


With a 50 percent chance it might not. Are we fortune tellers who guess which one
might be true?

Thus seperating logic into enter and exit conditions makes sense.


Let us assume a loop with variable iterations where the iteration count is passed
as function parameter. The code inside the loop body uses this iteration count as
index into an array and alters data in other arrays depending on computations and
set flags.

If we probed the loop's repeat condition at the end of the loop body per default,
we had to verify the passed iteration count before we enter the loop - otherwise,
the program crashed with erroneously passed negative numbers. We also had to sort
out zero. Otherwise, we started a count down through the full 32 or 64 bit range.
The last problem pops up, if the loop's repeat condition isn't met. In this case,
we had to restore all altered data before we could continue with the instructions
following the loop body.

Programming on machine language level grants us the freedom to create the fastest
possible code. It is no good idea to slow down our code just to obey questionable
"Universal Laws".


BTW: I placed label 0 at the wrong place. The proper loop should look like this:

func:...
...
0:dec rcx
jbe 1f
...
some
code
to
perform
...
jmp 0b

p2align 5,,31
1:continue
with
something
else
...


Greetings from Augsburg

Bernhard Schornak
 
G

Grant Edwards

There are people here who hate Google Groups but simply don't chime in.
I'm one of them. Perhaps I should.

More that a few of us just filter out all posts made from Google
Groups.
 
R

rurpy

I agree. Wikipedia is convenient but almost never suitable
as a learning resource. I'll see if I can find a friendlier
general netiquette link. Recommendations welcome.

I am hesitant to put too many general netiquette rules
there. Such rules aren't applicable to only GG users.
The alternate recommendations made to GG users here
(to use usenet and email) are always made without a
list of netiquette rules even though the recipients
are the same people using GG. Why should GG users be
told about those rules when they get advice about using
GG but not when they get advice to use email or usenet?

What would be best I think is a separate page with general
guidelines for posting that any user could be pointed to.

Regarding esr's "smart-questions", although I acknowledge
it has useful advice, I have always found it elitist and
abrasive. I wish someone would rewrite it without the
"we are gods" attitude.

Thanks again for your feedback.
 
C

Chris Angelico

Regarding esr's "smart-questions", although I acknowledge
it has useful advice, I have always found it elitist and
abrasive. I wish someone would rewrite it without the
"we are gods" attitude.

I find it actually pretty appropriate. The attitude comes from a
hierarchy in which we are not at the top - but neither is esr. On the
roleplaying game Threshold, there's a help file about that, which
succinctly sums up what I'm trying to say, but it doesn't seem to be
on the web, so unless you want to telnet to thresholdrpg.com, create
an account, and type "help hierarchy" at the prompt, you can't see the
text of it. Oh well. :| Anyway, point is: We're in a hierarchy (or
actually several independent and unrelated ones), and being at the top
means (in the open source world) being everyone's servant; and the
people at the top simply don't have time to be _everyone's_ servant
personally, so they need some sous-servants to help them to help
people. (Obvious example of that in the Python community is Guido at
the top, other core committers and PEP writers and so on helping him,
and then the large crew of core question-answerers, bug triagers,
patch writers, etc, etc, etc.) You offer courtesy to those who are
above you; they're giving of their time freely, making themselves your
servants, and all they ask is that you make it easy for them to do so.
That's a pretty good deal for all of us at the bottom of the hierarchy
:)

ChrisA
 
S

Skybuck Flying

Because it's logical.

"
What is logical?
"

To put the exit condition at the bottom is logical.

The exit condition glues the loop to the code that will be executed next
which is also at the bottom.

Example:

Loop

NextCode

^


Placing the exit ondition near next code makes more sense at least in
situation where I was programming.

I will give you an example:



LoopBegin( Step = 10 )

if ButtonExists then
begin
ClickButton()
end;

LoopEnd( ButtonClicked )

Execute next code...

This loop waits for the button to appear, once it's found it is clicked and
then the loop exits to continue the next code.

Putting this exit condition on the top makes no sense.

Bye,
Skybuck.
 
S

Steven D'Aprano

To put the exit condition at the bottom is logical.

The exit condition glues the loop to the code that will be executed next
which is also at the bottom.

Skybuck, please excuse my question, but have you ever done any
programming at all? You don't seem to have any experience with actual
programming languages.

In a while loop, such as in Python, the test is at the top of the loop
because the test is performed at the start of the loop, not the end:

while x > 0:
do_this()
do_that()


It would be inappropriate (as well as ugly!) to put the test at the end
of the loop, like this:

x = 0
while:
do_this()
do_that()
many more lines go here
possibly even pages of code
until finally, at long last
you get to the end where you find the test...
x > 0

.... and discover whether or not the while loop was actually entered or
not. Similarly with for-loops, the loop condition is at the beginning
because it runs at the beginning. This would be silly:

for i:
body of loop goes here
could be many many lines of code
even pages of code
but eventually, at long last
we get to the end, and find out
what the first value for i will be
in range(100, 110)


There is one sort of loop where it makes sense to have the loop condition
at the end. Python doesn't have such a loop, but Pascal does: the repeat
until loop. Unlike while, repeat until is always executed at least once,
so the loop condition isn't tested until the end of the loop:

repeat
do this
do that
do something else
until x > 0



[...]
LoopBegin( Step = 10 )

if ButtonExists then
begin
ClickButton()
end;

LoopEnd( ButtonClicked )

Execute next code...

This loop waits for the button to appear, once it's found it is clicked
and then the loop exits to continue the next code.

What if the button has already appeared before the loop starts?

I think that is better written as:


# Check the loop condition at the start
while the button does not exist:
wait a bit
# Outside the loop
click the button

(Although such a loop is called a "busy wait" loop, since it keeps the
computer being busy without doing anything useful. There are better ways
to do this than a loop.)

Even in Pascal, I would use a while loop rather than repeat, but if you
insist on using repeat, clicking the button still should go on the
outside of the loop:

# this is wasteful, since even if the button exists, the loop still
# waits a bit, for no good reason
repeat
wait a bit
until the button exists
click the button


Putting this exit condition on the top makes no sense.

Wait until you actually start programming before deciding what makes
sense or doesn't.
 
W

wolfgang kern

Bernhard Schornak replied to a "Flying-Bucket-post":

Methink we all know about the often not-so-logical ideas from
Buck, they merely come from an abstracted view and are far away
from todays hardware given opportunities.

OTOH, I sometimes got to think about his weird ideas, but mainly
figured that his demands are already covered by hardware but may
not have entered his Delphi/Python-HLL-world yet.
Most of the asked features may be found implemented in the C/C+-
area even just as intrisincs since a while anyway now.

__
wolfgang
(for those who dont know:
I'm a purist machine code programmer since more than 35 years)
 
R

rurpy

]
Skybuck, please excuse my question, but have you ever done any
programming at all? You don't seem to have any experience with actual
programming languages.
[...]
Wait until you actually start programming before deciding what makes
sense or doesn't.

Couldn't you have simply made your points without the above comments?
Those points stand perfectly fine on their own without the ad hominem
attack.
 
S

Steven D'Aprano

]
Skybuck, please excuse my question, but have you ever done any
programming at all? You don't seem to have any experience with actual
programming languages.
[...]
Wait until you actually start programming before deciding what makes
sense or doesn't.

Couldn't you have simply made your points without the above comments?
Those points stand perfectly fine on their own without the ad hominem
attack.

Not every observation about a person is "ad hominem", let alone an
attack, even if they are uncomplimentary. You are mistaken to identify
such observations as both.

"Ad hominem" is the standard term for a logical fallacy, whereby a claim
is rejected solely because of *irrelevant personal characteristics* of
the person making the claim, rather than allowing it to stand on its own
merits. It is not an ad hominem to call somebody a pillock. It is,
however, an ad hominem to imply that *merely because they are a pillock*
their arguments must therefore be wrong.

Ad hominems:

"Henry's argument cannot be believed, as he is known to hang
around loose women, thieves and tax collectors."

"Of course George would oppose the war, he's a homosexual."

"Clearly Julie is mistaken, she's just a girl, what would
she know about programming?"


Not ad hominems:

"Susan's argument in favour of the proposal is influenced by
the fact that she will make a lot of money if it goes ahead."

"David has no experience with Oracle databases, and his advice
about Oracle technology should be taken with caution."

"Barry is a plonker. His post is good evidence of this, and
here are the reasons why..."


Skybuck's experience at programming *is relevant* to the question of
whether or not he understands what he is talking about.

If you consider that merely suggesting that somebody is not experienced
at programming counts as an attack, well, words fail me.

If you want to accuse me of anything underhanded, "poisoning the well"
would be more appropriate. At least that is in the ball-park. A cynical,
nasty-minded person [this is an example of poisoning the well] might
consider that by merely pointing out that Skybuck appears to have no
actual experience in programming, I'm trying to influence others to
reject his claims out of hand. If that's how you want to see it, I can't
stop you. On the other hand, an alternative interpretation is that by
gently reminding Skybuck that he doesn't have any real experience in the
topic he's discussing (or so it seems), he'll be encouraged to actually
learn something.

I think it is quite unfair of you to misrepresent my post as an attack,
particularly since my reply gave an example of a type of loop that
supports Skybuck's position.
 
R

rurpy

]
Skybuck, please excuse my question, but have you ever done any
programming at all? You don't seem to have any experience with actual
programming languages.
[...]
Wait until you actually start programming before deciding what makes
sense or doesn't.

Couldn't you have simply made your points without the above comments?
Those points stand perfectly fine on their own without the ad hominem
attack.

Not every observation about a person is "ad hominem", let alone an
attack, even if they are uncomplimentary. You are mistaken to identify
such observations as both.

"Ad hominem" is the standard term for a logical fallacy, whereby a claim
is rejected solely because of *irrelevant personal characteristics* of
the person making the claim [...]

Skybuck's experience at programming *is relevant* to the question of
whether or not he understands what he is talking about.

No. You claimed his proposition "made no sense" based on your
analysis of it. You then used your conclusion to claim he has
no programming experience. You can not then use that latter
claim to support the argument that his proposition makes no
sense. (That is circular.) His programming experience is a
personal characteristic, and (limiting ourself to your arguments),
can conclude inexperience only if we've already accepted your
conclusion that his proposal is nutty, so his experience seems
irrelevant to me. Hence it meets your definition of an
ad hominem argument.

Secondly, the example ad hominem argument you gave, "Clearly
Julie is mistaken, she's just a girl, what would she know about
programming?" depends on the non-validity of the logical
implication. Yet I'm sure you are aware that are some people
who would find that a valid implication and if you could not
defend it, then you would not be able to claim ad hominem.
Of course it *is* easily defendable which is why you used it
as an example. But in your reply to Skybuck, the implication
is "nutty proposal" -> inexperience. Yet we frequently see
highly educated and experienced people who support nutty ideas
all the time, things like homeopathic medicine or psychic
abilities. So I think your claim that you were not using an
ad hominem argument is weak on that ground too.

(Even if none of the above were true, I would still ask, why
shouldn't someone's opinion on a programming topic stand on
their arguments alone without regard to whether they've written
code on a physical machine?)
If you consider that merely suggesting that somebody is not experienced
at programming counts as an attack, well, words fail me.

You didn't "merely suggest", you claimed it to be true:

"Wait until you actually start programming before deciding
what makes sense or doesn't."
[...]
I think it is quite unfair of you to misrepresent my post as an attack,
particularly since my reply gave an example of a type of loop that
supports Skybuck's position.

It wasn't unfair because it wasn't a misrepresentation. Your
irrelevant speculation about programming experience when the
issue he brought up was constructs for loops would raise most
people's hackles who offered their opinion in good faith.

Further, quoting from his original post,

"(after having some experience with python which lacks repeat
until/goto/labels and programming game bots)"

you are also implying he is a liar. So yes, it certainly is
fair to describe your response as an attack.

Given that your speculation added nothing to the reasonable
part of your response (which as I said was perfectly fine on
it's own) and likely served only to antagonize, why add it?
(Unless of course you enjoy a good flame-fest like so many
of the resident trolls here.)
 
R

rurpy

I find it actually pretty appropriate. The attitude comes from a
hierarchy in which we are not at the top - but neither is esr. On the
roleplaying game Threshold, there's a help file about that, which
succinctly sums up what I'm trying to say, but it doesn't seem to be
on the web, so unless you want to telnet to thresholdrpg.com, create
an account, and type "help hierarchy" at the prompt, you can't see the
text of it. Oh well. :| Anyway, point is: We're in a hierarchy (or
actually several independent and unrelated ones), and being at the top
means (in the open source world) being everyone's servant; and the
people at the top simply don't have time to be _everyone's_ servant
personally, so they need some sous-servants to help them to help
people. (Obvious example of that in the Python community is Guido at
the top, other core committers and PEP writers and so on helping him,
and then the large crew of core question-answerers, bug triagers,
patch writers, etc, etc, etc.) You offer courtesy to those who are
above you; they're giving of their time freely, making themselves your
servants, and all they ask is that you make it easy for them to do so.
That's a pretty good deal for all of us at the bottom of the hierarchy

This is a matter of philosophy and opinion so it is way
off-topic and not something I want to continue discussing
but...

One doesn't offer courtesy in return for free software,
one offers courtesy because the other person is a human
being and with courtesy is how you'd like him to treat
you. But in the open software world we're often not
talking about demands for courtesy so much as for
deference.

The reasonable quid-pro-quo in open software is that
developers get enjoyment of producing good stuff, voluntary
respect and thanks, free feedback, bug reporting, patches.
Users get good free software. There is no need for more
than that.

Your hierarchy is particularly unappealing to me. We all
know that such hierarchies exist in the real world, but
there is a question: should they be promoted as a natural
and desirable state of society to be encouraged?

There are people like Ayn Rand who have argued they are
natural and should be encouraged. But I, having grown
up with the concepts of democracy, egalitarianism, and
individualism in which treatment I ask for I should also
extend to you, don't accept those views. In fact I
think they have a somewhat fascist odor. I don't wish
to participate in a culture or sub-culture in which such
"worth" hierarchies are promoted.

Finally, your choice of a game based on feudal medieval
standards of behavior and morality to explain your view
does not help your argument IMO.
 
S

Steven D'Aprano

On 10/30/2013 04:22 AM, Steven D'Aprano wrote:

No. You claimed his proposition "made no sense" based on your analysis
of it.

I said absolutely nothing of the sort. You're making that quote up -- not
just misinterpreting what I said, or taking my words in the worst
possible way, but completely inventing things I never said. Not only did
I never say that Skybuck's proposition "made no sense", but I gave an
example of a language with a loop that does exactly what he wants, and
explicitly described as making sense:

"There is one sort of loop where it makes sense to have the loop condition
at the end. Python doesn't have such a loop, but Pascal does: the repeat
until loop."

I don't know whether to be more offended for myself, that you would
invent such a bare-faced falsehood about what I said, or for anyone else
reading this thread, that you should assume they would fail to notice
that not only did I not say what you quote me as saying, but that it is
the *opposite* of what I actually said.

I don't know whether you are deliberately lying, or whether you're just
such a careless reader that you have attributed words actually written by
Skybuck to me, but either way I expect an apology from you for putting
false words into my mouth.

As for the rest of your argument, I am not of the opinion that he is an
inexperienced programmer because his proposal is "nutty" (YOUR word, not
mine) since I don't think his proposal is completely nutty. There are use-
cases for putting the loop condition at the end. I think he is an
inexperienced programmer because of the lack of any sign in his emails
that he has any meaningful experience in programming.

As for your defence[1] of the ad hominem "Clearly Julie is mistaken,
she's just a girl, what would she know about programming?", I am not one
of those cultural relativists who thinks that any belief, no matter how
stupid, should be judged on how sincere the person expressing it is.
Regardless of how sincere they might be, they are simply *wrong*, their
argument is irrational, and it is an ad hominem fallacy. Women, even
"girls", are capable of having detailed knowledge about programming, and
there is no logical or factual reason for debating this point, any more
than we should be debating whether or not people with brown hair or flat
feet can program.

(Even if none of the above were true, I would still ask, why shouldn't
someone's opinion on a programming topic stand on their arguments alone
without regard to whether they've written code on a physical machine?)

Of course their arguments stand on their merits. But those merits are
likely to be pretty slim, if their arguments are not grounded in reality.
We know what happens when "great thinkers" start philosophising without
any grounding in reality, we get Pliny the Elder who concluded that elks
have no knees, and Aristotle, who was married twice but apparently never
thought to look inside either of his wives' mouth, who maintained that
women have fewer teeth than men. And so we come back to Skybuck, who
apparently believes that the use of GOTO instead of loops makes code more
reliable and easier to maintain.




[1] To head off false accusations that I'm misrepresenting you, here for
the record are your exact words:

Secondly, the example ad hominem argument you gave, "Clearly
Julie is mistaken, she's just a girl, what would she know about
programming?" depends on the non-validity of the logical
implication. Yet I'm sure you are aware that are some people who
would find that a valid implication and if you could not defend it,
then you would not be able to claim ad hominem. Of course it *is*
easily defendable which is why you used it as an example.
[end quote]

On the contrary, the implication that women cannot program is utterly
counterfactual and hence is indefensible. It simply isn't and cannot be
true. Even if there was not a single female programmer in the world --
and in reality there are thousands or tens of thousands -- there is
nothing in biology, chemistry, physics or abstract logic to suggest that
female Homo sapiens in this world could be inherently incapable of
programming.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top