Skip to content

Commit

Permalink
notes on redo semantics, restrict to lexotic
Browse files Browse the repository at this point in the history
  • Loading branch information
TimToady committed Nov 12, 2013
1 parent fdc1356 commit 20876cc
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions S04-control.pod
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Synopsis 4: Blocks and Statements

Created: 19 Aug 2004

Last Modified: 4 Nov 2013
Version: 128
Last Modified: 12 Nov 2013
Version: 129

This document summarizes Apocalypse 4, which covers the block and
statement syntax of Perl.
Expand Down Expand Up @@ -80,6 +80,16 @@ discover that identity), but for the dynamic fallback, the exception
will contain only the loop label to be matched dynamically. See
L</Control Exceptions> below.

The C<redo> operator, as a variant of C<goto>, directly transfers
control to the first statement of the lexotically enclosed loop.
Essentially, the compiler turns it into a C<goto> with an implicitly
generated (secret) label on that first statement. In order to know
when that implicit label must be generated, we restrict C<redo> to
the current outer lexical scope. It may not be used dynamically.
(If you find yourself wanting the dynamic variant, please use C<goto>
with an explicit label instead, so the compiler can know to pessimize
any unrolling of that loop.)

=head1 The Relationship of Blocks and Declarations

Every block is a closure. (That is, in the abstract, they're all
Expand Down

0 comments on commit 20876cc

Please sign in to comment.