Larry Wall writes:
> In that case we'd have to say that "given" and "for" always require
> "-> $x" inside methods, and that $x is never automatically aliased to
> $_.  But there are other ramifications with switch statements and
> exception handlers I have to think through, 

In particular, the fact that `map` rebinds $_.  Consider:

    method data () {
        map { .process($_) } @.array;
    }

Is that calling `$_.process($_)` for each `$_` in [EMAIL PROTECTED], or is it
calling `$self.process($_)`?  It must be the former, which, given the
context, is probably not what was intended (despite the terrible (but
unfortunately, typical) naming, we can still tell what the programmer
was thinking).  `.process` means something else everywhere else in the
method, and Perl goes to great lengths to keep it that way, but in this
case it's different.  

And it would be a shame to disallow the use of $_ in map.

Disallowing one of the most beautiful areas of Perl, topicalization, in
methods would be irritating at best.  "Oh, so I can only program in a
crappy subset of Perl because I'm in a method?"  I don't know about the
other programmers here, but just about all my code is in methods.
Actually, scanning over my most recent module, *all* my code is in
methods, except for the tests.

Luke

Reply via email to