On 24 Aug 2004, at 22:14, Aaron Sherman wrote:
You don't HAVE to use auto-topicalization. You CAN always write it
long-hand if you find that confusing:

        for @words -> $word {
                given ($chars($word) > 70) -> $toolong {
                        say abbreviate($word) ?? $word;
                }
        }

But, I find:

        for @words -> $word {
                say $word ~~ abbreviate($word) ?? $word;
        }

much simpler! Overall, I would discourage the use of C<$_> as topic in
most situations. We spent so long in Perl 5 wanting the ability to
default to whatever variable we wanted, to keep using C<$_> in the
general case now that we have that is kind of a step backwards.

But you are re-creating the same problem that we had in Perl 5.

By only allowing $_ to decide which expression to evaluate you are
prohibiting the use of anything that acts on the default topic of
the enclosing block in those expressions. This is exactly the problem
of nested maps etc. in Perl 5.

Don't get me wrong, I like the idea. But it does not come without its
own set of limitations.

Graham.



Reply via email to