Bryan wrote:
> > C<try> and C<catch>
>
> [ LABEL: ]
> try { block }
> [ [ catch [ ( expr ) ] { block } ] ... ]
the "expr" is more likely to be a "parameter_specification".
> > > Conditional Statement Modifiers
> > >
> > > 6. [ LABEL: ] expr if expr;
> > > 7. [ LABEL: ] expr unless expr;
> >
> > I'm not at all sure modifiers will be stackable, as this grammar implies.
>
> Er, parsing error. Are you saying I've got it right or wrong? (I'm
> intending non-stackable.)
Hmmmm. I had assumed that your grammar implies a statement is an expr.
But perhaps it didn't.
> > Though I would *much* prefer to see:
> >
> > 21. sub identifier [ ( prototype ) ] [ :traits ] { block }
> > 22. sub [ ( prototype ) ] [ :traits] { block } [is properties]
>
> Ah, traits is what I meant. But that's not final yet?
By no means. Larry has not told me what he thought of my revised
properties/traits proposal.
> > > A statement consists of zero or more expressions, followed by an
> > > optional modifier and its expression, and either a statement
> > > terminator (';') or a block closure ('}' or EOF).
> >
> > Need to recast this in terms of statement separators and null statements.
>
> Wouldn't a null statement be covered by a statement of 0 expressions?
Oops. Yes. I missed that. So you just need to s/terminator/separator/
> And while I'm at it, I have some questions for you!
Curses! ;-)
> Would you *please* consider reforming the 'when expr : { block }' clause as
> when ( expr ) { block }
> ?
That's Larry's syntax. And Larry's decision. For what it's worth, I have
previously argued against that colon. And you'll note that Switch.pm doesn't
require it (except in Perl 6 compatibility mode)
> Secondly, do 'when' clauses have targettable labels?
They are not 'clauses', they are statements. So yes, a C<when> can definitely
take a label.
> given ( $a ) {
> when /a/ : { foo($a); next BAR }
> when /b/ : { ... }
> BAR: when /c/ : { ... }
> ...
> }
That would be:
given ( $a ) {
when /a/ : { foo($a); goto BAR }
when /b/ : { ... }
BAR: when /c/ : { ... }
...
}
Using C<next BAR> would (presumably) cause control to head up-scope
to the first *enclosing* block labelled 'BAR'.
Damian