Re: voting on GOTO

new topic     » goto parent     » topic index » view thread      » older message » newer message

Jim Brown wrote:
> 
> Ok, so here is the official voting thread for the proposal on goto and label.
>   
> My proposal was basically a goto that was restricted to using only labels in
>    
> the current scope, but otherwise unrestricted.
> 
> Please vote yes or no, or abstain. Comments appreciated.
> 
> The full details of the proposal as currently slated, are:
> 
> goto and labels are only valid in the current scope. You can use the keyword
> goto to        
> jump around in the same file at top level scope (but not across files,     
>     
> only within the same file) and you can use goto to jump around inside      
>     
> routines. But you can't jump across scope. Goto can't see labels that      
>     
> are outside of the current local scope, and there is no support for a      
>     
> 'global' scope. The current local scope will either be the top-level       
>      
> scope of the file code is currently executing from, or the private scope   
>     
> of the routine that goto is executing inside of.                           
>   
> Labels are defined with the label keyword, and are strings.  You can define
> and use labels in the top-level scope of a file, but this is discouraged.
>                                                                            
>     
> Scoping isn't affected by loops. This includes for loops. Any other type   
>     
> of loop, jumping in and out works as you expect it would.                  
>     
> You can just backwards and forwards. Labels do not have to come before goto
> statements or vice versa.
>                                                                            
>     
> For for loops, jumping out doesn't appear to cause any problems. Jumping   
>     
> into a for loop leaves the loop variable uninitialized, which can cause    
>     
> problems if you allow execution to reach the end of the for loop. (If      
>     
> you dont read the loop var and you jump back out of the for loop, then     
>     
> it works fine. If you only jump around theinside of a for loop but allow   
>     
> the for loop to start iteration normally, then it also works fine.         
>     
> Likewise if you jump to a label that is right before the start of a for    
>     
> loop.)                                                                     
>     
> 
> It is possible to check if a variable is uninitialized. The recommended way
> to deal with for loops is, if you must jump into a for loop, check if the
> variable
> is uninitialized and jump to a label that is right before the the beginning
> of the for loop statement to continue iteration.
> Jumping into for loops is discouraged, however.

I think i'd have just said "no jumping into uninitialised loops". I don't know
why you'd do that anyhow offpaw, unless you are using goto and a while loop to
simulate a repeat-until loop (which Eu does not have). Otherwise you are prolly
just trying to save a couple bytes of memory and reuse existing code, which isn't
so necessary nowadays. You don't need to goto into a structure simulating the
case/switch statement that Eu doesn't have, but which you can make with goto.

I vote YES on having goto.

Kat

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu