Damian Conway wrote:
>
> return ( $stuff, $morestuff, $whatever ) always close F;
>
> I *really* like that keyword.
>
> Though I'd prefer to see it as a block suffix:
>
> sub {
> ...
> return $yadda_yadda;
> }
> always { close F }
In RFC 119, I allowed the "always" syntax to be applied to statements. Of
course, blocks are statements on steriods, so one can allow a block on either
side of the always keyword, achieving both effects.
> Then you could add it to loops as well, in conjunction with the C<continue>:
>
> while (1) {
> ... # add to $text in complex ways
> }
> continue { $text .= "\n"; } # separate with newlines
> always { $trycount++ } # count attempts (including last)
RFC 119 didn't say much about applying it to looping blocks, mostly because I
didn't think of the possible implications. When doing so, the big decision
would be whether the always RHS statement is executed once per loop, or just
once. Since you can always
{ while (1) {
... # add to $text in complex ways
}
continue { $text .= "\n"; }# separate with newlines
}
always { $trycount++ } # count attempts (including last)
I think I'd prefer that it be executed once per loop.
And to perhaps satisfy Abigail, one can apply always to a continue block
slightly indirectly:
while (1) {
... # add to $text in complex ways
}
continue {
{ $text .= "\n"; } # separate with newlines
always { $trycount++ } # count attempts
}
--
Glenn
=====
Even if you're on the right track,
you'll get run over if you just sit there.
-- Will Rogers
----- Stuff below this added by NetZero -----
Shop online without a credit card
http://www.rocketcash.com
RocketCash, a NetZero subsidiary