On Wed, Feb 27, 2002 at 08:02:08AM -0800, Austin Hastings wrote:
>
> BTW, C<for> doesn't alias $_ always. That's why things like the example
> below are possible.
Yes. C<for> and C<given> will only alias $_ when they are not aliasing a
named variable.
> Hmm. Suppose we force C<when> to alias $_, but give the coder one
> chance to "save" the value:
>
> for @A {
> for @B -> $x {
> when /a/ $_ -> $a { s/a/b/; ... $a ...; }
> }
> }
>
> Once we get inside the curlies, $_ is aliased to the localized var for
> the C<when> (in this case, $x).
I'm still not convinced of your basic point, that it would be a good
thing to have C<when> aliasing $_. Variations on whether it does it
automatically or at my request and how don't change the fundamental
concept. C<when> is a conditional like C<if>, not a topicalizer.
Allison