Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #9632 > unrolled thread

Simulate goto

Started byArchos <raul.san@sent.com>
First post2011-12-27 01:19 -0800
Last post2011-12-27 14:50 -0800
Articles 14 on this page of 34 — 14 participants

Back to article view | Back to comp.lang.javascript


Contents

  Simulate goto Archos <raul.san@sent.com> - 2011-12-27 01:19 -0800
    Re: Simulate goto Archos <raul.san@sent.com> - 2011-12-27 01:50 -0800
      Re: Simulate goto Archos <raul.san@sent.com> - 2011-12-27 02:09 -0800
        Re: Simulate goto Erwin Moller <Since_humans_read_this_I_am_spammed_too_much@spamyourself.com> - 2011-12-27 11:31 +0100
    Re: Simulate goto "Tom de Neef" <tdeneef@qolor.nl> - 2011-12-27 12:12 +0100
      Re: Simulate goto Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-12-27 18:27 +0100
        Re: Simulate goto John G Harris <john@nospam.demon.co.uk> - 2011-12-28 16:56 +0000
          Re: Simulate goto Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-12-28 19:10 +0100
            Re: Simulate goto Jake Jarvis <pig_in_shoes@yahoo.com> - 2011-12-28 23:18 +0100
              Re: Simulate goto Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-12-29 12:18 +0100
                Re: Simulate goto John G Harris <john@nospam.demon.co.uk> - 2011-12-29 16:31 +0000
                  Re: Simulate goto Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-12-29 17:47 +0100
                    Re: Simulate goto John G Harris <john@nospam.demon.co.uk> - 2011-12-30 11:04 +0000
                      Re: Simulate goto Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-12-30 16:10 +0100
    Re: Simulate goto John G Harris <john@nospam.demon.co.uk> - 2011-12-27 14:41 +0000
    Re: Simulate goto Denis McMahon <denismfmcmahon@gmail.com> - 2011-12-27 15:32 +0000
      Re: Simulate goto Gene Wirchenko <genew@ocis.net> - 2011-12-27 10:12 -0800
        Re: Simulate goto "Evertjan." <exjxw.hannivoort@interxnl.net> - 2011-12-27 19:55 +0000
          Re: Simulate goto Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> - 2011-12-27 21:49 +0100
            Re: Simulate goto Denis McMahon <denismfmcmahon@gmail.com> - 2011-12-27 23:07 +0000
            Re: Simulate goto John G Harris <john@nospam.demon.co.uk> - 2011-12-28 16:28 +0000
              Re: Simulate goto Nomen Nescio <nobody@dizum.com> - 2011-12-28 22:33 +0100
          Re: Simulate goto Gene Wirchenko <genew@ocis.net> - 2011-12-27 13:19 -0800
            Re: Simulate goto "Evertjan." <exjxw.hannivoort@interxnl.net> - 2011-12-27 22:02 +0000
              Re: Simulate goto Tim Streater <timstreater@greenbee.net> - 2011-12-27 22:18 +0000
                Re: Simulate goto Mike Duffy <Use_guestbook_page@website.in.sig> - 2011-12-28 00:23 +0000
                  Re: Simulate goto John G Harris <john@nospam.demon.co.uk> - 2011-12-28 16:37 +0000
                    Re: Simulate goto Tim Streater <timstreater@greenbee.net> - 2011-12-28 17:44 +0000
                      Re: Simulate goto Mike Duffy <Use_guestbook_page@website.in.sig> - 2011-12-29 01:16 +0000
                        Re: Simulate goto Gene Wirchenko <genew@ocis.net> - 2011-12-28 17:34 -0800
                          Re: Simulate goto "Evertjan." <exjxw.hannivoort@interxnl.net> - 2011-12-29 08:27 +0000
                          Re: Simulate goto Dr J R Stockton <reply1152@merlyn.demon.co.uk> - 2011-12-30 20:54 +0000
                            Re: Simulate goto Tim Streater <timstreater@greenbee.net> - 2011-12-31 11:55 +0000
              Re: Simulate goto Gene Wirchenko <genew@ocis.net> - 2011-12-27 14:50 -0800

Page 2 of 2 — ← Prev page 1 [2]


#9727

FromJohn G Harris <john@nospam.demon.co.uk>
Date2011-12-28 16:28 +0000
Message-ID<9GdQnCFZO0+OFw1O@J.A830F0FF37FB96852AD08924D9443D28E23ED5CD>
In reply to#9692
On Tue, 27 Dec 2011 at 21:49:38, in comp.lang.javascript, Hans-Georg
Michna wrote:
>On 27 Dec 2011 19:55:41 GMT, Evertjan. wrote:
>
>>Gene Wirchenko wrote on 27 dec 2011 in comp.lang.javascript:
>
>>> Some algorithms are more easily expressed with a goto.
>
>>I do not think so.
>>
>>Goto makes havoc of a programme,
>>as programmse should be build from modular blocks,
>>whose entrees and exits should not be compromized bij wrong levels.
>
>There are valid exceptions. One prime example is the state
>machine, sometimes also called finite-state machine or syntax
>machine. By far the fastest and easiest implementation is to go
>from one state, implemented as a block of statements or simply a
>label, to another with a goto.
>
>I still suspect, like you, that most attempts to use a goto
>statement in other contexts than breaking a loop are not very
>sensible.

Bjarne Stroustrup (the inventor of C++) wrote that goto is for code
generators where the program writing the code isn't going to get
confused. E.g A program that reads a syntax specification and writes a
parser for the language.

  John
-- 
John Harris

[toc] | [prev] | [next] | [standalone]


#9743

FromNomen Nescio <nobody@dizum.com>
Date2011-12-28 22:33 +0100
Message-ID<8e5ac25e52020fbd3c14034f7574e4a6@dizum.com>
In reply to#9727
> >I still suspect, like you, that most attempts to use a goto
> >statement in other contexts than breaking a loop are not very
> >sensible.

Depends on the language. GOTO is idiomatic in many older (foundation)
languages while inappropriate in most newer ones. That has led the snot
nosed kids to believe GOTO is old outmoded bad etc. It is not. It has its
place but that place is not C or languages derived from C (although the
Linux kernel developers use it and will give you a good spanking if you
criticise them).

> Bjarne Stroustrup (the inventor of C++) wrote that goto is for code
> generators where the program writing the code isn't going to get
> confused. E.g A program that reads a syntax specification and writes a
> parser for the language.

That might be the case in C++ and he should know since he wrote it.

But GOTO is for mere humans when coding in F77, COBOL, BASIC, and many other
languages that were written before C.

[toc] | [prev] | [next] | [standalone]


#9693

FromGene Wirchenko <genew@ocis.net>
Date2011-12-27 13:19 -0800
Message-ID<chckf7d7hcsg4he6m40go9ph1qrve27jij@4ax.com>
In reply to#9689
On 27 Dec 2011 19:55:41 GMT, "Evertjan."
<exjxw.hannivoort@interxnl.net> wrote:

>Gene Wirchenko wrote on 27 dec 2011 in comp.lang.javascript:
>
>> Some algorithms are more easily expressed with a goto.
>
>I do not think so.
>
>Goto makes havoc of a programme,

     No, it does not.  It can.  Very much use of it practically
guarantees it, but it is not a given.  A well-placed goto can simplify
code immensely.

>as programmse should be build from modular blocks,
>whose entrees and exits should not be compromized bij wrong levels.

     Why?  I follow this myself, but I might make an exception in an
extreme case.

>This was already apparent in the time
>of Edsger Wybe Dijkstra (1930–2002)
><http://en.wikipedia.org/wiki/Edsger_W._Dijkstra>
>who advocated "theoretical correctness" in programming:
>
>Edsger Dijkstra (March 1968). "Go To Statement Considered Harmful" (PDF). 
>Communications of the ACM 11 (3): 147–148.
>
>and read Edsger's 1968 comment here:
>
>Dijkstra used the word "nested" where we nowadays say "modular".
>
><http://www.cs.utexas.edu/users/EWD/transcriptions/EWD10xx/EWD1009.html>

     Please do not try teaching your grandfather how to suck eggs.  I
am quite aware of Dijkstra's opinion.  The man was far too doctrinaire
for my taste.  Another of his statements was "It is practically
impossible to teach good programming to students that have had a prior
exposure to BASIC: as potential programmers they are mentally
mutilated beyond hope of regeneration."  Oh, really?

>>  This is not a usual case though.
>
>Could you elaborate?
>
>I think you mean "this is usually not the case"?
>Methinks it never, never is the case.

     Now, try proving your statement.

     One of the sort algorithms, I think quick-sort, has a symmetry
between the front and back pointers that is readily seen if it is
coded with a couple of goto statements, but that does not show so
cleanly when it is not.

     Hans-Georg Michna also mentioned a state machine, and having
written a number of them, I concur.  It is the best example that I am
aware of.

     Exiting from nested loops can be done much more easily with a
goto.  Ah, but you may say to use break.  break statements, especially
those with a label target, are specialised goto statements.  I tend to
avoid using them, but other do prefer them.

     Lastly, there is the case when performance is absolutely
critical.  In this case, one might well sacrifice clarity.  I would
code a sructured version first and test that it really was too slow
before sacrificing, but were it indicated, I would proceed with the
sacrifice.

Sincerely,

Gene Wirchenko

[toc] | [prev] | [next] | [standalone]


#9694

From"Evertjan." <exjxw.hannivoort@interxnl.net>
Date2011-12-27 22:02 +0000
Message-ID<Xns9FC8EA64D857Feejj99@194.109.133.133>
In reply to#9693
Gene Wirchenko wrote on 27 dec 2011 in comp.lang.javascript:

> On 27 Dec 2011 19:55:41 GMT, "Evertjan."
> <exjxw.hannivoort@interxnl.net> wrote:
> 
>>Gene Wirchenko wrote on 27 dec 2011 in comp.lang.javascript:
>>
>>> Some algorithms are more easily expressed with a goto.
>>
>>I do not think so.
>>
>>Goto makes havoc of a programme,
> 
>      No, it does not.  It can.  Very much use of it practically
> guarantees it, but it is not a given.  A well-placed goto can simplify
> code immensely.
> 
>>as programmse should be build from modular blocks,
>>whose entrees and exits should not be compromized bij wrong levels.
> 
>      Why?  I follow this myself, but I might make an exception in an
> extreme case.
> 
>>This was already apparent in the time
>>of Edsger Wybe Dijkstra (1930–2002)
>><http://en.wikipedia.org/wiki/Edsger_W._Dijkstra>
>>who advocated "theoretical correctness" in programming:
>>
>>Edsger Dijkstra (March 1968). "Go To Statement Considered Harmful"
>>(PDF). Communications of the ACM 11 (3): 147–148.
>>
>>and read Edsger's 1968 comment here:
>>
>>Dijkstra used the word "nested" where we nowadays say "modular".
>>
>><http://www.cs.utexas.edu/users/EWD/transcriptions/EWD10xx/EWD1009.html
>>> 
> 
>      Please do not try teaching your grandfather how to suck eggs.  I
> am quite aware of Dijkstra's opinion.  The man was far too doctrinaire
> for my taste.  

Your taste about this man is not an issue here, the issue is his sound 
explanation of his ideas.

> Another of his statements was "It is practically
> impossible to teach good programming to students that have had a prior
> exposure to BASIC: as potential programmers they are mentally
> mutilated beyond hope of regeneration."  Oh, really?

Yes quite. BASIC should be understood as the BASIC of thatr time,
not the Visual Basic and its predessesors of young William Gates
that incorporated Dijkstra's ideas from Algol-60 etc.

Perhaps you do not know the level of BASIC at that time, 
where only this existed:

IF boolean GOTO

and not yet:

IF boolean THEN

And that corrupted a generation of programmmers for the idea of 
"nesting", what we now call modular programing.

 
>>  This is not a usual case though.
>>
>>Could you elaborate?
>>
>>I think you mean "this is usually not the case"?
>>Methinks it never, never is the case.
> 
>      Now, try proving your statement.

You first prove yours, I askesd first, 
you talk about "Some algorithms are more easily expressed with a goto".

Why should I prove my rebuttal to this unsubstaniated sentence?
 
>      One of the sort algorithms, I think quick-sort, has a symmetry
> between the front and back pointers that is readily seen if it is
> coded with a couple of goto statements, but that does not show so
> cleanly when it is not.

What nonsense, recursive programming can just as well be done in a 
modular way. 

It seems you also are bitten by the goto-bug. Are you that old? 

If so, it proves my point NOT to teach new programmers the idea of GOTO 
in any language higher than chip microcode or assembler.
 
>      Hans-Georg Michna also mentioned a state machine, and having
> written a number of them, I concur.  It is the best example that I am
> aware of.

It seems you to do not know what that means.

The computer is a state m-machine by itself, 
governed by a central state stepping clock.

There is nore reason to duplicate that, except for teaching purposes.

Even then there is no necessary or even useful reason to use a goto 
there.

But please if you must, show us an example where the goto statement is a 
necessary or just usefull statement to use [INSIDE Javascript, this is a 
JS NG] 

Methinks your would-be pupils will just be set on the wrong foot,
and they won't like you for it if they screw up on modular thinking. 

> Exiting from nested loops can be done much more easily with a
> goto. 

No, no, no.
Than you loose the concept of modularity, corrupting inner return 
ppoiners in the process. Modern compilers will revover from this, but 
with time consuming internal correction code ...

.. or hopefully by optimalisation, in fact throwing your GOTO out in an 
attempt to restore modularity. 

> Ah, but you may say to use break.  break statements, especially
> those with a label target, are specialised goto statements.  I tend to
> avoid using them, but other do prefer them.

I might not. Break statements are just the means of goto-adepts to 
suppress their goto-world-view to a pseudo-modular world.

The other day I expressed my disgust for switch statement, 
and I remember you concurred.

>      Lastly, there is the case when performance is absolutely
> critical.  In this case, one might well sacrifice clarity.  I would
> code a sructured version first and test that it really was too slow
> before sacrificing, but were it indicated, I would proceed with the
> sacrifice.

Show me that case, if you can!

There is no such case in optimizing compilers, 
but more to the point, there is not GOTO in javascript.

Implementing such GOTO, as was tried in this thread, will sacrifize any 
even unfounded idea of speed gain.


> Sincerely,
> 
> Gene Wirchenko
> 



-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#9695

FromTim Streater <timstreater@greenbee.net>
Date2011-12-27 22:18 +0000
Message-ID<timstreater-C43FF8.22184027122011@news.individual.net>
In reply to#9694
In article <Xns9FC8EA64D857Feejj99@194.109.133.133>,
 "Evertjan." <exjxw.hannivoort@interxnl.net> wrote:

> But please if you must, show us an example where the goto statement is a 
> necessary or just usefull statement to use [INSIDE Javascript, this is a 
> JS NG]

I haven't used a GOTO since I stopped writing FORTRAN in 1978.

> No, no, no.
> Than you loose the concept of modularity, corrupting inner return 
           ~~~~~

Lose. Please get this right, it is more irritating than anything that 
Pointy-Head does.

-- 
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted"  --  Bill of Rights 1689

[toc] | [prev] | [next] | [standalone]


#9699

FromMike Duffy <Use_guestbook_page@website.in.sig>
Date2011-12-28 00:23 +0000
Message-ID<Xns9FC8C547B1D32invalidcom@94.75.214.39>
In reply to#9695
Tim Streater <timstreater@greenbee.net> wrote in
news:timstreater-C43FF8.22184027122011@news.individual.net: 

> In article <Xns9FC8EA64D857Feejj99@194.109.133.133>,
>  "Evertjan." <exjxw.hannivoort@interxnl.net> wrote:

>> Than you loose the concept of modularity, corrupting inner return 

> Lose. Please get this right, it is more irritating than anything that 
> Pointy-Head does.


1. It seems like a minor error; possibly even a typo. The sense of what he 
meant was abundantly clear. In fact, he may have been deliberately 
deploying a pun.

2. Is PE our community-accepted standard for guaging the irritation level 
of grammar and spelling errors?

-- 
http://pages.videotron.ca/duffym/index.htm

[toc] | [prev] | [next] | [standalone]


#9728

FromJohn G Harris <john@nospam.demon.co.uk>
Date2011-12-28 16:37 +0000
Message-ID<F2Qe7BHuW0+OFwxd@J.A830F0FF37FB96852AD08924D9443D28E23ED5CD>
In reply to#9699
On Wed, 28 Dec 2011 at 00:23:28, in comp.lang.javascript, Mike Duffy 
wrote:
>Tim Streater <timstreater@greenbee.net> wrote in
>news:timstreater-C43FF8.22184027122011@news.individual.net:
>
>> In article <Xns9FC8EA64D857Feejj99@194.109.133.133>,
>>  "Evertjan." <exjxw.hannivoort@interxnl.net> wrote:
>
>>> Than you loose the concept of modularity, corrupting inner return
>
>> Lose. Please get this right, it is more irritating than anything that
>> Pointy-Head does.
>
>
>1. It seems like a minor error; possibly even a typo. The sense of what he
>meant was abundantly clear. In fact, he may have been deliberately
>deploying a pun.

It's a spelling error that's been popular for around 15 years. It's very 
likely that it's been spread by the internet. Even teachers and 
journalists make the mistake. And I also think it's very irritating.

It makes life very difficult for dictionary compilers :

   loose (v)
     (1) Obsolete spelling of lose, q.v.
     (2) ...

   lose (v)
     (1) Obsolete spelling of loose, q.v.
     (2) ...

And finally :
If 'lose' is now spelt with oo, is 'loosen' the plural of 'luser' ?

   John
-- 
John Harris

[toc] | [prev] | [next] | [standalone]


#9735

FromTim Streater <timstreater@greenbee.net>
Date2011-12-28 17:44 +0000
Message-ID<timstreater-4DC8A8.17442728122011@news.individual.net>
In reply to#9728
In article 
<F2Qe7BHuW0+OFwxd@J.A830F0FF37FB96852AD08924D9443D28E23ED5CD>,
 John G Harris <john@nospam.demon.co.uk> wrote:

> On Wed, 28 Dec 2011 at 00:23:28, in comp.lang.javascript, Mike Duffy 
> wrote:
> >Tim Streater <timstreater@greenbee.net> wrote in
> >news:timstreater-C43FF8.22184027122011@news.individual.net:
> >
> >> In article <Xns9FC8EA64D857Feejj99@194.109.133.133>,
> >>  "Evertjan." <exjxw.hannivoort@interxnl.net> wrote:
> >
> >>> Than you loose the concept of modularity, corrupting inner return
> >
> >> Lose. Please get this right, it is more irritating than anything that
> >> Pointy-Head does.
> >
> >
> >1. It seems like a minor error; possibly even a typo. The sense of what he
> >meant was abundantly clear. In fact, he may have been deliberately
> >deploying a pun.
> 
> It's a spelling error that's been popular for around 15 years. It's very 
> likely that it's been spread by the internet. Even teachers and 
> journalists make the mistake. And I also think it's very irritating.

All the more reason to stamp on it.

-- 
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted"  --  Bill of Rights 1689

[toc] | [prev] | [next] | [standalone]


#9748

FromMike Duffy <Use_guestbook_page@website.in.sig>
Date2011-12-29 01:16 +0000
Message-ID<Xns9FC9CE2E28EDCinvalidcom@94.75.214.39>
In reply to#9735
Tim Streater <timstreater@greenbee.net> wrote in
news:timstreater-4DC8A8.17442728122011@news.individual.net: 

> In article 
> <F2Qe7BHuW0+OFwxd@J.A830F0FF37FB96852AD08924D9443D28E23ED5CD>,
>  John G Harris <john@nospam.demon.co.uk> wrote:

>> Even teachers and journalists make the mistake. 
>> ... And I also think it's very irritating.

> All the more reason to stamp on it.

If it is a mistake being made by teachers and journalists, I agree. If it 
is a mistake being made by someone who learned English as a second language 
(like Evertjan / PE), then you should probably make some allowance.

-- 
http://pages.videotron.ca/duffym/index.htm

[toc] | [prev] | [next] | [standalone]


#9749

FromGene Wirchenko <genew@ocis.net>
Date2011-12-28 17:34 -0800
Message-ID<6rgnf75echlnruev288nmmfpilgnecg3sa@4ax.com>
In reply to#9748
On Thu, 29 Dec 2011 01:16:03 +0000 (UTC), Mike Duffy
<Use_guestbook_page@website.in.sig> wrote:

>Tim Streater <timstreater@greenbee.net> wrote in
>news:timstreater-4DC8A8.17442728122011@news.individual.net: 
>
>> In article 
>> <F2Qe7BHuW0+OFwxd@J.A830F0FF37FB96852AD08924D9443D28E23ED5CD>,
>>  John G Harris <john@nospam.demon.co.uk> wrote:
>
>>> Even teachers and journalists make the mistake. 
>>> ... And I also think it's very irritating.
>
>> All the more reason to stamp on it.
>
>If it is a mistake being made by teachers and journalists, I agree. If it 
>is a mistake being made by someone who learned English as a second language 
>(like Evertjan / PE), then you should probably make some allowance.

     I often see better English on the Net from ESLers than native
speakers.

Sincerely,

Gene Wirchenko

[toc] | [prev] | [next] | [standalone]


#9756

From"Evertjan." <exjxw.hannivoort@interxnl.net>
Date2011-12-29 08:27 +0000
Message-ID<Xns9FCA604525F7Beejj99@194.109.133.133>
In reply to#9749
Gene Wirchenko wrote on 29 dec 2011 in comp.lang.javascript:

> On Thu, 29 Dec 2011 01:16:03 +0000 (UTC), Mike Duffy
> <Use_guestbook_page@website.in.sig> wrote:
> 
>>Tim Streater <timstreater@greenbee.net> wrote in
>>news:timstreater-4DC8A8.17442728122011@news.individual.net: 
>>
>>> In article 
>>> <F2Qe7BHuW0+OFwxd@J.A830F0FF37FB96852AD08924D9443D28E23ED5CD>,
>>>  John G Harris <john@nospam.demon.co.uk> wrote:
>>
>>>> Even teachers and journalists make the mistake. 
>>>> ... And I also think it's very irritating.
>>
>>> All the more reason to stamp on it.
>>
>>If it is a mistake being made by teachers and journalists, I agree. If
>>it is a mistake being made by someone who learned English as a second
>>language (like Evertjan / PE), then you should probably make some
>>allowance. 

Well, unlike PE as I presume, English was! my first language, but when I 
started learning to write, Dutch was my primary one.
 
>      I often see better English on the Net from ESLers than native
> speakers.

Quite so, nativity induces naivity in language, especially in monoglots.

As soon as Tim's Dutch is better than mine, I would be inclined to listen 
to him in this case.

Even more so, Netiquette says it is inappropriate co comment on spelling-
mistakes in NG that do not have that as a topic. 

Methinks that is because it acts as a loose goto in a close-topiced tread.

loose [lOOs] adj [...]; (of bowels) inclined to diarrhoea;[...]

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#9817

FromDr J R Stockton <reply1152@merlyn.demon.co.uk>
Date2011-12-30 20:54 +0000
Message-ID<7hOxRNE8Ti$OFw$e@invalid.uk.co.demon.merlyn.invalid>
In reply to#9749
In comp.lang.javascript message <6rgnf75echlnruev288nmmfpilgnecg3sa@4ax.
com>, Wed, 28 Dec 2011 17:34:18, Gene Wirchenko <genew@ocis.net> posted:

>On Thu, 29 Dec 2011 01:16:03 +0000 (UTC), Mike Duffy
><Use_guestbook_page@website.in.sig> wrote:
>
>>Tim Streater <timstreater@greenbee.net> wrote in
>>news:timstreater-4DC8A8.17442728122011@news.individual.net:
>>
>>> In article
>>> <F2Qe7BHuW0+OFwxd@J.A830F0FF37FB96852AD08924D9443D28E23ED5CD>,
>>>  John G Harris <john@nospam.demon.co.uk> wrote:
>>
>>>> Even teachers and journalists make the mistake.
>>>> ... And I also think it's very irritating.
>>
>>> All the more reason to stamp on it.
>>
>>If it is a mistake being made by teachers and journalists, I agree. If it
>>is a mistake being made by someone who learned English as a second language
>>(like Evertjan / PE), then you should probably make some allowance.
>
>     I often see better English on the Net from ESLers than native
>speakers.

Most of the self-called "native English speakers" are native to your
Southern Neighbour.  But, with the exception of a petrol-pump attendant
in s'H... ...h, the Dutch that I have had dealings with all speak and
write English so well that there is no reason not to drive them to
perfection.

-- 
 (c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk  Turnpike v6.05  MIME.
  Web  <http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms and links;
  Astro stuff via astron-1.htm, gravity0.htm ; quotings.htm, pascal.htm, etc.
 No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.

[toc] | [prev] | [next] | [standalone]


#9822

FromTim Streater <timstreater@greenbee.net>
Date2011-12-31 11:55 +0000
Message-ID<timstreater-53C9A0.11551731122011@news.individual.net>
In reply to#9817
In article <7hOxRNE8Ti$OFw$e@invalid.uk.co.demon.merlyn.invalid>,
 Dr J R Stockton <reply1152@merlyn.demon.co.uk> wrote:

> In comp.lang.javascript message <6rgnf75echlnruev288nmmfpilgnecg3sa@4ax.
> com>, Wed, 28 Dec 2011 17:34:18, Gene Wirchenko <genew@ocis.net> posted:
> 
> >On Thu, 29 Dec 2011 01:16:03 +0000 (UTC), Mike Duffy
> ><Use_guestbook_page@website.in.sig> wrote:
> >
> >>Tim Streater <timstreater@greenbee.net> wrote in
> >>news:timstreater-4DC8A8.17442728122011@news.individual.net:
> >>
> >>> In article
> >>> <F2Qe7BHuW0+OFwxd@J.A830F0FF37FB96852AD08924D9443D28E23ED5CD>,
> >>>  John G Harris <john@nospam.demon.co.uk> wrote:
> >>
> >>>> Even teachers and journalists make the mistake.
> >>>> ... And I also think it's very irritating.
> >>
> >>> All the more reason to stamp on it.
> >>
> >>If it is a mistake being made by teachers and journalists, I agree. If it
> >>is a mistake being made by someone who learned English as a second language
> >>(like Evertjan / PE), then you should probably make some allowance.
> >
> >     I often see better English on the Net from ESLers than native
> >speakers.
> 
> Most of the self-called "native English speakers" are native to your
> Southern Neighbour.  But, with the exception of a petrol-pump attendant
> in s'H... ...h, the Dutch that I have had dealings with all speak and
> write English so well that there is no reason not to drive them to
> perfection.

Indeed. I once had occasion to call someone at Unisource in, IIRC, 
Amsterdam. I misdialled and ended up with a random person elsewhere in 
the Netherlands. This individual responded perfectly well in English.

Even meerkats speak English. See:

<http://www.comparethemeerkat.com/>

-- 
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted"  --  Bill of Rights 1689

[toc] | [prev] | [next] | [standalone]


#9696

FromGene Wirchenko <genew@ocis.net>
Date2011-12-27 14:50 -0800
Message-ID<tfhkf7lbu0br5esu6acg8h2l0o2rvm7hq0@4ax.com>
In reply to#9694
On 27 Dec 2011 22:02:32 GMT, "Evertjan."
<exjxw.hannivoort@interxnl.net> wrote:

>Gene Wirchenko wrote on 27 dec 2011 in comp.lang.javascript:
>
>> On 27 Dec 2011 19:55:41 GMT, "Evertjan."
>> <exjxw.hannivoort@interxnl.net> wrote:
>> 
>>>Gene Wirchenko wrote on 27 dec 2011 in comp.lang.javascript:
>>>
>>>> Some algorithms are more easily expressed with a goto.
>>>
>>>I do not think so.
>>>
>>>Goto makes havoc of a programme,
>> 
>>      No, it does not.  It can.  Very much use of it practically
>> guarantees it, but it is not a given.  A well-placed goto can simplify
>> code immensely.

     Are you unable to counter this case?

>>>as programmse should be build from modular blocks,
>>>whose entrees and exits should not be compromized bij wrong levels.
>> 
>>      Why?  I follow this myself, but I might make an exception in an
>> extreme case.

>>>This was already apparent in the time
>>>of Edsger Wybe Dijkstra (1930–2002)
>>><http://en.wikipedia.org/wiki/Edsger_W._Dijkstra>
>>>who advocated "theoretical correctness" in programming:
>>>
>>>Edsger Dijkstra (March 1968). "Go To Statement Considered Harmful"
>>>(PDF). Communications of the ACM 11 (3): 147–148.
>>>
>>>and read Edsger's 1968 comment here:
>>>
>>>Dijkstra used the word "nested" where we nowadays say "modular".
>>>
>>><http://www.cs.utexas.edu/users/EWD/transcriptions/EWD10xx/EWD1009.html

>>      Please do not try teaching your grandfather how to suck eggs.  I
>> am quite aware of Dijkstra's opinion.  The man was far too doctrinaire
>> for my taste.  
>
>Your taste about this man is not an issue here, the issue is his sound 
>explanation of his ideas.

     I do not consider that insulting people as mentally mutilated as
he did in the quote following is sound.

>> Another of his statements was "It is practically
>> impossible to teach good programming to students that have had a prior
>> exposure to BASIC: as potential programmers they are mentally
>> mutilated beyond hope of regeneration."  Oh, really?
>
>Yes quite. BASIC should be understood as the BASIC of thatr time,
>not the Visual Basic and its predessesors of young William Gates
>that incorporated Dijkstra's ideas from Algol-60 etc.
>
>Perhaps you do not know the level of BASIC at that time, 
>where only this existed:

     And perhaps I know exactly what the BASICs of the time were like.
I do; I used them.

>IF boolean GOTO
>
>and not yet:
>
>IF boolean THEN

     Actually, quite often the syntax was
          IF <expression> THEN <lineno>
where <expression> was very simple indeed: no boolean operators.

>And that corrupted a generation of programmmers for the idea of 
>"nesting", what we now call modular programing.

     Oh, nonsense!  When I then ran into other languages, I picked up
their features quickly enough.

>>>  This is not a usual case though.
>>>
>>>Could you elaborate?
>>>
>>>I think you mean "this is usually not the case"?
>>>Methinks it never, never is the case.
>> 
>>      Now, try proving your statement.
>
>You first prove yours, I askesd first, 
>you talk about "Some algorithms are more easily expressed with a goto".

     I have already given an example.  You are making the
extraordinary claim.  How about you prove yours?

>Why should I prove my rebuttal to this unsubstaniated sentence?

     I have already given the relevant detail in the following
paragraph.

>>      One of the sort algorithms, I think quick-sort, has a symmetry
>> between the front and back pointers that is readily seen if it is
>> coded with a couple of goto statements, but that does not show so
>> cleanly when it is not.
>
>What nonsense, recursive programming can just as well be done in a 
>modular way. 

     I was not referring to the recursion, but to one level of
sorting.  Quick sort has a pointer that starts from one end and
another that starts from the other.  With the pair of goto statements,
the symmetry is readily apparent.

>It seems you also are bitten by the goto-bug. Are you that old? 

     No, I am not bitten by it.  I simply refuse to totally demonise
goto statements.  I do not use goto statements but rarely, but
sometimes, they are acceptable.

     At 51, probably.

>If so, it proves my point NOT to teach new programmers the idea of GOTO 
>in any language higher than chip microcode or assembler.
> 
>>      Hans-Georg Michna also mentioned a state machine, and having
>> written a number of them, I concur.  It is the best example that I am
>> aware of.
>
>It seems you to do not know what that means.

     Since I have written a number of state machines, I do know what
it means.

>The computer is a state m-machine by itself, 
>governed by a central state stepping clock.

     Oh, I know, but Mr. Michna and I are referring to something else:
applications that have state machines.

>There is nore reason to duplicate that, except for teaching purposes.

     A compiler typically uses state machines.  I use state machines
in certain validation routines for a client billing app I support.
There are plenty of other examples.  Try writing a calculator program
without using a state machine.

>Even then there is no necessary or even useful reason to use a goto 
>there.

     I have found it useful.

>But please if you must, show us an example where the goto statement is a 
>necessary or just usefull statement to use [INSIDE Javascript, this is a 
>JS NG] 

     Probably less necessary since JavaScript code is typically not
very long and not very time-sensitive.

>Methinks your would-be pupils will just be set on the wrong foot,
>and they won't like you for it if they screw up on modular thinking. 

     Actually, I have successfully taught people programming.  I would
not make the mistake of telling them that goto statements are pure
evil.  I would tell them why it is not a good idea, in general, to use
them and where they might, might use them to good advantage.  I would
also note that it is probably less often than they think.

>> Exiting from nested loops can be done much more easily with a
>> goto. 
>
>No, no, no.
>Than you loose the concept of modularity, corrupting inner return 
>ppoiners in the process. Modern compilers will revover from this, but 
>with time consuming internal correction code ...

     In many languages, those blocks are now out of scope and their
variables will be tossed.

>.. or hopefully by optimalisation, in fact throwing your GOTO out in an 
>attempt to restore modularity. 
>
>> Ah, but you may say to use break.  break statements, especially
>> those with a label target, are specialised goto statements.  I tend to
>> avoid using them, but other do prefer them.
>
>I might not. Break statements are just the means of goto-adepts to 
>suppress their goto-world-view to a pseudo-modular world.

     I do prefer the use of control variables.  The client billing app
I just referred to has none -- I just checked -- but I do not consider
that my view rules over all.

>The other day I expressed my disgust for switch statement, 
>and I remember you concurred.

     I do not like switch because of bad syntax (just plain bad and
because it breeds errors) and semantic limitations.

>>      Lastly, there is the case when performance is absolutely
>> critical.  In this case, one might well sacrifice clarity.  I would
>> code a sructured version first and test that it really was too slow
>> before sacrificing, but were it indicated, I would proceed with the
>> sacrifice.
>
>Show me that case, if you can!

     Do some reading on your own.  When one is extremely constrained
in what one is programming, some of the usual practices get tossed.  I
have read of programmers describing how they had to fit their code in
2048 bytes and no more.  To do such things, they would load opcodes to
do arithmetic, because the particular opcode had the right value.

     Yes, very unreadable code, but too long of code, in that case,
was so wrong that it would not run.

>There is no such case in optimizing compilers, 
>but more to the point, there is not GOTO in javascript.

     The goto statement in JavaScript is continue.

>Implementing such GOTO, as was tried in this thread, will sacrifize any 
>even unfounded idea of speed gain.

     Maybe.  If it really mattered on the time issue, I would
benchmark it.

Sincerely,

Gene Wirchenko

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.javascript


csiph-web