Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #9694
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: Simulate goto |
| From | "Evertjan." <exjxw.hannivoort@interxnl.net> |
| References | <ef9039a7-0cf7-4887-a98e-81c49968555b@p42g2000vbt.googlegroups.com> <4ef9e511$0$16555$a8266bb1@newsreader.readnews.com> <eh2kf7tbrdvgbjh0otfl5neu5huk8ok8na@4ax.com> <Xns9FC8D4E2AFC9Deejj99@194.109.133.133> <chckf7d7hcsg4he6m40go9ph1qrve27jij@4ax.com> |
| Message-ID | <Xns9FC8EA64D857Feejj99@194.109.133.133> (permalink) |
| Date | 2011-12-27 22:02 +0000 |
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)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
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
csiph-web