[GEN] gotos revisited yet again

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

Mike Sabal wrote:

> So what data type is the label?

A 'goto' is a statement, not a data type.


> Assume for a moment that adding a new
> symbol table is not the troublesome task
> that it is.

Hrm? I don't see how it's a "troublesome task"; it's typically fairly simple
to implement.


> What if we say, let's limit the scope of a
> label to the routine it's contained in.
> Well, that would make it easier, but then
> we'd have to have yet another run-time error
> check to make sure we're in scope.

No, not really. At the end of the scope (routine, module, whatever), just
check to see if the label has been resolved. If not, generate an error. So
the resolution is at compile time.

Robert already does similar checks if you declare a variable, but never
assign it. In comparison, this is trivial.


> Now what symbology do we use for labels?

Why is this so difficult? The syntax:

   label:

is well accepted; there's no need to invent something new.


> But what do we do with labels just before
> and end or elsif?  Are they part of the
> if or part of the else?  Can we now jump from
> an if to an else inside the same routine?

I hate to say it, but this looks more like FUD than a reasoned argument
against gotos. To hear you tell it, this is all uncharted territory. But
just look at any of the major languages that implement gotos: C, Basic, etc.
Virtually every question has a trivial (and tested) answer.

You seem to imply that the goto 'breaks' Yet consider the 'include'
statement. You can't place it in a loop or a routine:

   -- no can do!
   for i = 1 to 10 do
      include file.e
   end for

and despite the rule that Euphoria ignores white space, you can't write:

   include
   myfile.e

>From a 'how do we add it to the grammar' point of view, I don't see any
serious issues.

-- David Cuny

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

Search



Quick Links

User menu

Not signed in.

Misc Menu