Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!apple!agate!usenet From: raymond@math.berkeley.edu (Raymond Chen) Newsgroups: comp.lang.pascal Subject: Re: Gotos are ok (Was Re: IMPLEMENT GOTO ACROSS MODULES IN TURBO PASCAL??) Message-ID: <1991Jan17.174720.25984@agate.berkeley.edu> Date: 17 Jan 91 17:47:20 GMT References: <11656@j.cc.purdue.edu> <7147@tekgen.BV.TEK.COM> <11661@j.cc.purdue.edu> <1991Jan10.031015.15282@cs.mcgill.ca> <1991Jan10.122222.1013@uwasa.fi> <1991Jan16.005523.28337@syacus.acus.oz> Sender: usenet@agate.berkeley.edu (USENET Administrator) Reply-To: raymond@math.berkeley.edu (Raymond Chen) Followup-To: alt.religion.computers Organization: U.C. Berkeley Lines: 56 In-Reply-To: ian@syacus.acus.oz (Ian Joyner) [Followups redirected to alt.religion.computers, since this has escalated into a religious argument.] In article <1991Jan16.005523.28337@syacus.acus.oz>, ian@syacus (Ian Joyner) writes: >Prof. Timo Salmi writes- >>No gotos is just a mumbo jumbo myth by programming purists. >Dear prof Salmi, >if you tried writing gotoless programs you would soon realise it is >practical... I believe Mr Joyner is missing the point. The object of the game is *not* to write so-called "gotoless" programs. The object of the game is to write "structured" programs. For some reason, people have latched onto the concept of "goto-less programming" as if it were some sort of divine incantation, and that the word "goto" is blasphemy against God and Heaven. >The problem is [gotos] are too powerful, and thus >subject to undisciplined use. The same can be said for global variables and pointers (in languages that support them). Does Mr Joyner advocate the heavy-handed elimination of global variables? Selected juicy quotes from people who should know: The criticism has been voiced that the method of structured programming is in essence nothing more than programming by painstakingly avoiding the use of jumps (goto statements). One may, indeed, come to this conclusion by looking at the entire issue in the reverse direction. ... [T]he absence of jumps is not the initial aim, but the final outcome of the exercise. <> -- Niklaus Wirth, author of the Pascal language Please don't fall into the trap of believing that I am terribly dogmatical about [the goto statement]. I have this uncomfortable feeling that others are making a religion out of it, as if the conceptual problems of programming could be solved by a single trick, by a simple form of coding discipline! -- Edsger Dijkstra, author of "Go to statement considered harmful" It has also been proved (initally by Knuth-Floyd; sharper results were later obtained by Ashcroft-Manna, Bruno-Steiglitz, Kosaraju, and Peterson-Kasami-Tokura) that total elimination of goto's cannot be accomplished without the introduction of extraneous flag variables, or redundant computation. One might wish to read Computing Surveys, Vol 6. Nr. 4 (Dec 1974), which contains articles on the topic of structured programs (including Knuth's famous "Structured programming with go to statements").