Re: voting on GOTO - discussion.
- Posted by Lucius L. Hilley III <euphoria at un?mar?com> Jun 04, 2008
- 674 views
Derek Parnell wrote: > > Larry Miller wrote: > > > > As long term users of this forum will be well aware, Robert Craig was > > opposed > > to the introduction of goto into Euphoria. If this should ever happen I can > > imagine what his initial reaction might be: > > > > "WHAT HAVE THEY DONE TO MY BABY?" > > Almost ... here is his response ... > > ---------------------- > I vote No. > > I don't want to now have to spend a couple of seconds > scanning the source code for each routine (and top-level), > checking for possible GOTO's or labels, every time I pick up > someone else's Euphoria code. I like being absolutely safe > in the knowledge that there can't be any. > > e.g. to understand the control flow of any large block of code > containing: > > .... dozens of lines of code, running more than one screen > .... but are there any GOTO's or labels in here? > .... I guess I now have to scan it all to be certain I understand > .... the flow of control > > e.g. > while x do > Hmmm. I *used to* understand the possible > ways that control flow > could exit out of a while loop, but ... > (... any GOTO's or labels in here?) > < big chunk of messy code > > end while > > for i ... do > <big chunk of code> > any GOTO's ? > any labels? > can I even be sure the loop var has been initialized? No. > end for > > if x then -- used to look straightforward, but now ...? > <big chunk of code> > any GOTO's? > any labels? > else > <big chunk of code> > any GOTO's? > any labels? > end if > <snip> > Regards, > Rob Craig > Rapid Deployment Software > <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a> > ------------------- My response to this is definately not a vote. I can clearly see both sides. I easily understand both views. I have not voted as of yet and will reserve my decision for a little longer.
function example1(atom a) ... Lots of code if (a = 3.14159) then return "Early exit" end if ... Lots of code return "Normal exit" end function procedure example2(atom a) ... Lots of code if (a = 3.14159) then return --"Early exit" end if ... Lots of code return "Normal exit" end procedure --example3 for index = 1 to 300 do ... Lots of code if (trigger) then exit -- Early exit of the loop end if ... Lots of code end for --example4 while (trigger = 0) do ... Lots of code if (trigger) then exit -- Early exit of the loop end if ... Lots of code end while
Lucius L. Hilley III - Unkmar