RE: Kat's goto

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

On 6 Feb 2002, at 13:05, kbochert at ix.netcom.com wrote:

> 
> 
> I have been following the goto debate with interest. I believe that
> the carefull use of goto is very useful for simplifying code and
> I intend to add it to the Euphoria source.
> 
> I originally decided against it because it
> seemed very difficult, but after porting to LCC, adding
> initializations, slicing shorthands, and references, it now
> seems quite straightforward (should be about 2 days work). Using a
> translator to change goto's into structured code would be WAY beyond
> my capabilities.
> 
> A sample of the syntax I will be using is:
> 
> procedure foo()
>    ...
>    if ... then
>       ...
>       goto done
>    end if
>    ...
> :done:
> end procedure
> 
> Surrounding the labels with ':'s helps them stand out.
> 
> Labels and goto's will only be allowed in procedures or
> functions.

Perfectly acceptable, but just out of curiosity, why not in the main?

> Dangling goto's and unreferenced labels will be illegal.

What if you put them in --label-- ? Then unreferenced labels will be treated 
like comments by default. Either way, as you like, i won't quibble over this 
one, since making them illegal also has good points. Dangling gotos are 
definitely a programming error tho.

> Forward and backward references will be ok.
> 
> Karl Bochert

<giddy smile>
Kat

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

Search



Quick Links

User menu

Not signed in.

Misc Menu