On Wed, Feb 19, 2003 at 09:51:12AM +1100, Deborah Ariel Pickett wrote:
> That said, I don't know of anything that the C comma operator can do
> that you couldn't equivalently do with a Perl5 C<do> statement:
>
> foo() or (do { warn("blah"); next; }); # Yes, it's ugly.
Well, gee, it's not that ugly:
foo or do { warn "blah"; next };
Stripping off all unneeded parentheses. C<do> is a little redundant:
foo or { warn "blah"; next }();
And what if, something like m//, closures based whether they evaluate
on context. i.e. they I<would> evaluate in void context. Then we
have completely redundantized the C comma:
foo or { warn "blah"; next };
loop ({ $i=0; $j=20 }; $i <= 10 < $j; { $i++; $j-- }) {...}
When it wouldn't evaluate because of context, there's still C<do> and
() to do the trick.
Assuming you can do control flow from within a closure. Hmm... that
makes me cringe a bit. Oh, look, you can do it in Perl 5, though.
But I think all of us already agreed that the C comma is not
needed.
Luke