Re: voting on GOTO
- Posted by Jim Brown <jbrown105 at linuxbudd??st.net> Jun 06, 2008
- 807 views
c.k.lester wrote: > > Kat wrote: > > c.k.lester wrote: > > > Kat wrote: > > > > ...the most ultimately important vote in all of Euphoria's history: > > > > goto. > > > I asked for examples where GOTO would help streamline or otherwise make a > > > Euphoria program better. Nobody can provide any*- not even you, its most > > > vocal supporter and advocate. > > > (*Well, they haven't, yet.) > > It's been shown, been done, been 10 years. > > No, it hasn't. Ever. Not once. A Euphoria-code example. I think that goto does has merit as a way to improve the readability and maintainability of code. I and others provided examples (or links to such) which have not yet been contested. By you or any one else. With that issue out of the way .. you want to focus on speed. Fair enough. What you were asking was quite hard to do since one could have to be able to write it and somehow show that it works without actually being able to test the code. A rather high burden of proof. This is why most examples are done in other languages. In fact, to counter this, please come up with an example in euphoria where using goto slows down the code. Pretty please with a berry on top? For a real life example, compare the speed of EuRegex and PCRE. I'd ask to compare the speed of EuRegex to EuPCRE, but I can't. I'm confident that if EuPCRE did exist, it'd be faster than EuRegex. > > > Code has been provided, only to be > > shot down which chants of "can't it be done another way?" and "that's evil" > > and "who would want to do that?". So point me to the dunking chair, i'll sit > > down and buckle myself in... i acknowledge you win, but you are still wrong. > > Certainly there's somebody who advocates GOTO in Euphoria who could provide > an example of where a GOTO would significantly improve a Euphoria program's > performance. Pretend Euphoria has GOTO right now and wow the skeptics. Like I said in a previous post, using goto is a lot faster than function calls. Not that I'm advocating the abandonment of making function calls. But you did ask what could be faster. Real life examples that could be made faster? Uhm, any tall recursive function such as factorial(). Just one example. > > (Just today I reworked some of my BBCMF code and had it serving up pages in > HALF the time it was taking before! *pats self on back* Without GOTO, even.) > > Remember, I'm talking about Euphoria. The goto in C has been shown to be > beneficial to Euphoria. Great. But adding GOTO to Euphoria would be > beneficial... how? Speed of course, but there is also the improved maintainability and readability of code (if used correctly of course). In other languages, goto is also a good way to break out of nested loops and/or if statements. But with labeled loops, that issue is not relevant. (How to break out of a nested if statement? Surround it with a while loop, and add an 'exit' right before the 'end while' line! Nice hack, eh?)