> > Yeah, every once in a while, I've wanted the second layer, but I'm
> > willing to rewrite the statement as a true normal if/while instead of a
> > backwards if/while, and it *does* help the overall readability.
>
> I'd concede that the actual useful uses are rare enough to not warrant
> giving a feature that could turn hopelessly ugly quickly - even if the
> current generation of tools make it easy to add the feature.

Sorry to respond to my own post.  As soon as I sent the reply I still felt an 
itch for a second level.

I agree that such a thing could be abused as Randal mentioned.  But how many 
things are there in Perl 5 and Perl 6 that can't be abused (sorry - that is a 
sort of subjective thing to ask so I am putting it out hypothetically)?  It 
still seems odd to take some things out of the language but leave others in 
(ok - most things that have been left out have made perfect sense).  I'm much 
more a fan of the leaving in if the thing being left in doesn't have an 
exponential cost and if there isn't a good reason to exclude it.

We still have goto statements.  We have map and grep that now go forwards - 
but can still go backwards.

Taking it out doesn't necessarily prevent abuses since we now have repeat.

repeat {
  repeat {
    say "Oh no. Not again";
  } while $x++ < 10;
} while $y++ < 2;

As opposed to

say "Yes. Yes again"
    while $x++ < 10
        while $y++ < 2;
 
Additionally reading the documentation about repeat it seems that the 
following should already be allowed since the conditional statement on a 
repeat is not optional and if it doesn't come first then it MUST come later 
and if it MUST come later then it isn't a modifier.

my $x = 1; repeat { say "hello"; $x = 0 } while $x if $x;

Though I would expect the following to break because it wouldn't know to parse 
for the modifier after the closing brace:

my $x = 1; repeat while $x { say "hello"; $x = 0 } if $x;

This is what pugs does - though I'm not sure what it means.

pugs> my $x = 1; repeat { say "hello"; $x = 0 } while $x;
hello
0
pugs> my $x = 1; repeat { say "hello"; $x = 0 } while $x if $x;
....>

I think it means that I will probably need to have the correct behavior be 
clarified to me, obtain a commit bit and add a test to pugs.

Anyway.  Once again if the alleged crime or the predicted crime is too great 
then I concede.  I can see that it could be abused by some.  But that doesn't 
mean I will abuse it.

Paul

PS. And not that it matters, but TT3 is planned to support nested statement 
modifiers and my engine which does much of TT3 already supports them - and I 
do use them on occasion - but that's a different mailing list.

Reply via email to