Goto, I vote.
- Posted by Lucius L. Hilley III <euphoria at unk?ar.?om> Jun 06, 2008
- 669 views
Kat wrote: > Date: 2008 May 12 12:07 > Subject: Re: New Keyword added: continue > > Why? > Here's how you use one keyword instead of six: > > }}} <eucode> > > --repeat until > :repeat > x -= 1 > if x > 12 then goto repeat end if > > > -- case > atom fred, a, d > fred = 45 > a = 1 > d = 44 > > goto x > puts(1,x&" is not covered") goto caseend > :1 puts(1,"it's 1!") goto caseend > :34 puts(1,"wow, 34!") > :"Sam" puts(1,"you got Sam!" goto caseend > :a+d puts(1,"Yep, fred is 45!") goto caseend > :caseend > -- continue, retry, restart, and next > :restart > for loop = 1 to 12 do > :retry > -- code > if test = failed then goto retry end if > if thistest = failed then goto restart end if > if bored = true then goto next end if > if done then goto demoend end if > -- code > :next > end for > :demoend > > </eucode> {{{ > > You know exactly where each "goto" lands, each :target can be in your own > native > language, and OOEU prooves it can be done. It's ONE word. It's so SIMPLE. > > Kat I vote YES for goto. If we were voting today if we should remove continue, exit, or retry. I might say, YES. Properly created if statments can remove all but, the exit keyword in for loops. That can be handled easily with a while loop and an if statement. However we are voting to add a keyword that allows very similarly difficult to track flow of code. If these other easily worked around ugly keywords are allowed, Then why not a goto that handles them all? In fact, in the case of these others keywords.
for index= 1 to x do for index2 = 1 to y do if v = true then continue -- implicit location. goto "y_continue" -- explicit location. end if label "y_continue" end for end for
Lucius L. Hilley III - Unkmar