1. RE: goto
- Posted by mistertrik at hotmail.com Feb 10, 2002
- 562 views
Would it be difficult to be able to label loops? eg. for a = 1 to 100 as Main do for b = 1 to a do for c = 1 to 40 do ... if <condition> then exit Main end if end for end for end for --as in, would exit down to this comment. If that is possible, then it would make life a lot easier. That could replace both a break and a continue. Take wind away from the goto crowd too... :P ===================================================== .______<-------------------\__ / _____<--------------------__|=== ||_ <-------------------/ \__| Mr Trick
2. RE: goto
- Posted by Kat <gertie at PELL.NET> Feb 10, 2002
- 511 views
On 11 Feb 2002, at 16:14, mistertrik at hotmail.com wrote: > > Would it be difficult to be able to label loops? > > eg. > for a = 1 to 100 as Main do > for b = 1 to a do > for c = 1 to 40 do > > ... > > if <condition> then > exit Main > end if > end for > end for > end for > > --as in, would exit down to this comment. > > If that is possible, then it would make life a lot easier. That could > replace both a break and a continue. > > Take wind away from the goto crowd too... :P Hehe, it would be one of the disguised gotos, silly. With the actual goto, put the label before the loop, and goto it. Simple. Kat
3. RE: goto
- Posted by mistertrik at hotmail.com Feb 11, 2002
- 586 views
>Hehe, it would be one of the disguised gotos, silly. With the actual >goto, >put >the label before the loop, and goto it. Simple. > >Kat Yes, but restricted by the structure of the language. I would like to know how euman has implemented his goto's What happens if the programmer puts goto or label where they should not be?..Euman? ===================================================== .______<-------------------\__ / _____<--------------------__|=== ||_ <-------------------/ \__| Mr Trick
4. RE: goto
- Posted by kbochert at ix.netcom.com Feb 11, 2002
- 529 views
-------Phoenix-Boundary-07081998- You wrote on 2/11/02 4:50:12 AM: > >I would like to know how euman has implemented his goto's >What happens if the programmer puts goto or label where they should not >be?..Euman? Currently, my goto implementation can generate 6 Errors: 'goto's not allowed outside of subroutines' 'goto attempt to branch into loop' 'Subroutine missing label (:xxx:)' 'Duplicate Label' 'Expected Label, not keyword' 'Label syntax is ":label:"' and 1 warning: 'Unreferenced label' Goto is not allowed at file level (must be in function or procedure), and is not allowed to branch to a deeper nesting. Sort of prevents all the 'interesting' cases, I hope. Karl Bochert -------Phoenix-Boundary-07081998---
5. RE: goto
- Posted by Cuvier Christian <christian.cuvier at insee.fr> Jan 25, 2006
- 495 views
Subject: Re: goto Jeremy Peterson wrote: > I like languages that let the programmer do what he wants instead of what the > language creator thinks the programmer should be allowed to do. Goto is a valuable > part of a language, and very useful in cases where other language features haven't > been implemented like continue in loops. One con of putting goto in a language > though is that it slows it down, which is probably one reason Rob won't put > it in Euphoria. It may make it easier to write sloppy code, but people who > will do that will find some way to do it whether they have goto or not, so don't > punish the people who might need it by leaving it out. Hi Jeremy, In previous recent thread about 'goto', there was the example with the Euphoria 'exit' operator. For example, Turbo Basic 1.1 has 6 different 'exit' operators: exit select exit def exit for exit if exit loop exit sub Quick Basic 4.5 has 5 different 'exit' operators: EXIT DEF EXIT DO EXIT FOR EXIT FUNCTION EXIT SUB Plus they both have 'goto', 'gosub/return', subs and functions. And these *all* basic's *exits* serve for a single purpose, exactly to *exclude gotos* from the program structure. Euphoria has no goto, has no gosub/return, but has a single 'exit', and has 'return'/'return something' in procedures, functions and types. And a Euphoria programmer can do much much much much ... much more than all at all Turbo Basic 1.1 and Quick Basic 4.5 programmers in the World. Do you *want* to learn 11 exit operators to do all you *want* in these basics as a programmer? Just a joke. I think there is a good sense of humor on this list. Good Luck! Regards, Igor Kachan kinz at peterlink.ru ---------------------------------------- Euphoria has: end if end for end while end function end procedure end type just to exit a block of code, while most languages designers understood that just "end;", or just a character '}', or just an indentation change, would be good enough for the purpose. Isn't this even worse? I'd say yes, because you use "exit" far less often than "end". As far as the goto statement is concerned, my personal taste would be to have dedicated constructs taking care of its main uses. I think indeed that a language is made for the programer to do as litle translation as possible between his thought and executable, maintainable code. Euphoria can largely improve in this respect. A possibility could be - using "exit 3" to exit 3 levels of loop above current (so that exit 0 = exit), perhaps exit -2 to exit all loops but the outmost to. - continue/next would go to the top of the loop, executing its "starting" code (incrementing index or testing condition). Same extension. - retry (or goback?) to go to the top of the loop without executing the "initial" code. Same extension. - exif: like exit, but for if-blocks. Coded all that (and goto) in a modified version of the PD source, but I'm now working on the ESL, so that I didn't test it yet. CChris
6. RE: goto
- Posted by Igor Kachan <kinz at peterlink.ru> Jan 25, 2006
- 506 views
Cuvier Christian wrote: [snip] Igor Kachan wrote: >> Hi Jeremy, >> >> In previous recent thread about 'goto', there was the example >> with the Euphoria 'exit' operator. >> >> For example, Turbo Basic 1.1 has 6 different 'exit' operators: >> >> exit select >> exit def >> exit for >> exit if >> exit loop >> exit sub >> >> Quick Basic 4.5 has 5 different 'exit' operators: >> >> EXIT DEF >> EXIT DO >> EXIT FOR >> EXIT FUNCTION >> EXIT SUB >> >> Plus they both have 'goto', 'gosub/return', subs and functions. >> >> And these *all* basic's *exits* serve for a single purpose, exactly >> to *exclude gotos* from the program structure. >> >> Euphoria has no goto, has no gosub/return, but has a single 'exit', >> and has 'return'/'return something' in procedures, functions and types. >> >> And a Euphoria programmer can do much much much much ... much more >> than all at all Turbo Basic 1.1 and Quick Basic 4.5 programmers >> in the World. >> >> Do you *want* to learn 11 exit operators to do all you *want* >> in these basics as a programmer? >> >> Just a joke. I think there is a good sense of humor on this list. >> >> Good Luck! >> >> Regards, >> Igor Kachan >> kinz at peterlink.ru > ---------------------------------------- > Euphoria has: > end if same in basics > end for 'next' in basics > end while 'wend' in basics > end function 'end def' in basics > end procedure 'end sub' in basics > end type perpetual as' in basics > just to exit a block of code, while most languages designers understood that > just "end;", or just a character '}', or just an indentation change, would > be good enough for the purpose. Yes, perpetual ';' or '}' or 'end'. Tons of ';'. And me personally hates to see something like to: end; end; end; end; end; end; > Isn't this even worse? I'd say yes, because you use "exit" far less often > than "end". No, just more clear code. > As far as the goto statement is concerned, my personal taste would be to > have dedicated constructs taking care of its main uses. I think indeed that > a language is made for the programer to do as litle translation as possible > between his thought and executable, maintainable code. Euphoria can largely > improve in this respect. My main thought was and is: in basics, 5..6 different 'exits' are just for struggle with its own, basic's, 'goto'. Strange design. I know, it is for compatibility with older versions, but strange anyway. And I do not want an inner war of Euphoria key words. [snip] Good Luck! I'm out of town now, sorry. Regards, Igor Kachan kinz at peterlink.ru