Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

goto

0 views
Skip to first unread message

Larry Wall

unread,
Jan 31, 2006, 5:49:51 PM1/31/06
to perl6-l...@perl.org
Just added the following to S04:

=head1 The goto statement

In addition to C<next>, C<last>, and C<redo>, Perl 6 also supports
C<goto>. As with ordinary loop controls, the label is searched for
first lexically within the current subroutine, then dynamically outside
of it. Unlike with loop controls, however, scanning a scope includes
a scan of any lexical scopes included within the current candidate
scope. As in Perl 5, it is possible to C<goto> into a lexical scope,
but only for lexical scopes that require no special initialization
of parameters. (Initialization of ordinary variables does not
count--presumably the presence of a label will prevent code-movement
optimizations past the label.) So, for instance, it's always possible
to goto into the next case of a C<when> or into either the "then"
or "else" branch of a conditional. You may not go into a C<given>
or a C<for>, though, because that would bypass a formal parameter
binding (not to mention list generation in the case of C<for>).
(Note: the implicit default binding of an outer $_ to an inner $_
can be emulated for a bare block, so that doesn't fall under the
prohibition on bypassing formal binding.)

Larry

0 new messages