On Tue, 2005-04-26 at 17:13, Juerd wrote:

> > or you could have a keyword that introduces the label:
> >     rx/label <ws>+ <identifier> <ws>+ (<statement>|<control>)/
> > or you could use some kind of trickery:
> >     rx/label : $/
> 
> Or make it a macro.
> 
>     label<foo>; for 1... {
>         ...
>     }

This has debugging problems, and might limit how and when loops can be
unrolled automatically.

[...]
> Or just add quotes (yes, please) and keep the colon:
> 
>     "foo": for 1... {
>         next "foo";
>     }

That's not so bad... but it does offend the sense that a label is an
identifier on-par with a subroutine name. Hmm... that makes me think....
"label" is a bit heavy-weight for something that used to be implicit.
Perhaps what we need is a shorter name, and then it would not seem so
bad to have to have a keyword before the label:

        tag foo: for 1... {
                next foo;
        }

Yes, I like this for the following reasons:

      * It looks very much like a sub definition ("sub foo(" ~ "tag
        foo:")
      * There's no parser magic. It's just rx/tag <identifier> :
        (<statement> | <control>)/
      * It carries the legacy of the C-derived label well, such that a C
        programmer should be able to look at this code and know what it
        does.
      * "tag" is a short enough keyword that we're not going to clutter
        code with a very semantically light-weight idiom (syntactic
        complexity for semantic simplicity should indicate deprecated
        constructs, and as far as I know, no one is deprecating labels).
      * Tagging might be useful in other situations where a keyword
        would be useful for visually marking the construct. I have no
        good examples, though.

-- 
Aaron Sherman <[EMAIL PROTECTED]>
Senior Systems Engineer and Toolsmith
"It's the sound of a satellite saying, 'get me down!'" -Shriekback


Reply via email to