Re: Return from nested subroutines (still goto discussion)
- Posted by Ferlin Scarborough <ferlin1 at bellsouth.net> Nov 12, 2004
- 516 views
Enough with the goto's already....I did not mean to open a can of worms when I said I would not use them and did not care for them. We had this discussion in depth 4 or 5 years ago, no use in rehasing old ground. Here is a couple of messages from Robert Craig from the past. >Date: Mon, 15 Nov 1999 18:06:48 -0500 >From: Robert Craig <rds at ATTCANADA.NET> >Subject: Goto > >Since some people think I should come out of hiding >and voice an opinion on language design proposals, >here's my current thinking about goto. > >1. completely general goto, including jumps > between routines: 0% chance > >2. goto within a routine: 0.01% chance > >3. specialized goto to break out of nested loops: 1% chance > >I'm not religiously opposed to goto's. There are some >goto's coded into the C source of the interpreter, and >at one point in the early days I even had one of the >"between routines" gotos that are possible in C using >setjmp()/longjmp(). It proved to be nightmarishly hard >to understand and maintain so I took it out. > >I agree that a specialized goto (or special "exit") >to get out of a nested loop is probably less clumsy >than setting up artificial state variables. I just don't think >that this occurs often enough, or causes enough pain >to warrant a new language feature, such as labelled >statements and a special kind of exit. > >The normal sort of gotos, that let you jump around within >a routine are like cigarettes. One or two, once in a while, >will not harm you. The trouble is they become addictive. >If you never start using them, you will never have a craving >for one. > >When I had to maintain code written by someone >else, the sight of a heavily goto'd section of code would >really be discouraging. The guy who wrote the goto's >probably had some idea of what the control-flow was >supposed to be, but I had to struggle to get the >same picture into my head. Standard control-flow >statements, like for..end for, if-elsif-else etc are much >easier to digest and reason about. > >Regards, > Rob Craig > Rapid Deployment Software > http://www.RapidEuphoria.com > > >Date: Sat, 10 Jun 2000 11:59:11 -0400 >From: Robert Craig <rds at ATTCANADA.NET> >Subject: Re: (Fwd) Re: compiler?? step 4 > >Kat writes: >> another repost, no answer recieved again..... > >Rob Craig writes: >>> Extra temp variables >>> are used where needed, and all control-flow >>> constructs are reduced to goto's. > >Kat writes: >> Oh goodie, goto's!! ) >> Can we use them in the Eu code before compiling too? > >Sorry, because of your smiley I didn't think this was a serious >question. No, goto's will not be allowed in Euphoria. >The compiler generates them because it is mapping >from the low-level intermediate language into C. >In the intermediate language (used by both the interpreter >and the compiler) control-flow has already been >broken down into goto's. > >Rob Craig writes: >>>You can see >>> the original Euphoria statement as a C comment, >>> followed by the C statements that implement that >>> Euphoria statement. > >Kat writes: >>Hmm,,, sounds like you'll be giving away the store with that one. > >Yes, some very interesting information will be revealed. >However there is still a lot of information that won't be >revealed. I think it's worth the risk. > >Regards, > Rob Craig > Rapid Deployment Software > http://www.RapidEuphoria.com > > So, there you have it, the GOD or CREATOR of Euphoria has spoken, and the result is: "No, goto's will not be allowed in Euphoria." So, let's not beat a dead dog to death..... Later. Ferlin Scarborough Learn To Program Games in Free Courses At http://www.gameuniv.net My Euphoria Home Page http://mywebpage.netscape.com/shadetreesoft