=head1 TITLE

loop control and do

=head1 VERSION

  Maintainer: Nathan Torkington <[EMAIL PROTECTED]>
  Date: 1 Aug 2000
  Version: 0 (unreleased)
  Mailing List: [EMAIL PROTECTED]
  Number: (unassigned)

=head1 ABSTRACT

In version 5 and earlier, C<do {} while> does not create a block.
Thus the loop controls C<next>, C<last>, and C<redo> do not work
inside C<do {} while>.  In version 6 they should.

=head1 DESCRIPTION

The C<{}> in C<eval{}> and C<do{}> do not define blocks.  This is a
problem because C<do {} while> is the only way to get a bottom-testing
"loop".  This is not a real loop because the statement modifier version
of C<while> modifies the C<do> statement, not the non-block of code
in the C<{}>.  Thus C<last>, C<next>, and C<redo> do not work on a 
C<do {} while>.

However, they should.  Just because you want to test the loop at the
bottom doesn't mean that don't want to break out of the loop early.
So a modified C<do{}> should count as a block.

I've used C<while>, but the same goes for C<until>.

=head1 IMPLEMENTATION

There are two implementation strategies: identify modified C<do>s,
or treat C<do {} while> as a different construct.

=head2 Identify modified do

If Perl builds a C<do {}> modified by C<while> or C<until>, it should
rewrite it to build a real block inside the C<do>ne code.

=head2 Different construct

Teach the parser that C<do {} while> is not a statement modifier,
but instead a full loop.  That way the parser would construct the
block structure rather than requiring it to be grafted on later.

=REFERENCES

  perlsyn for explanation of loops in Perl 5

Reply via email to