Rob Kinyon skribis 2005-10-25  8:37 (-0400):
> Did you post this specifically to anti-address the fear that P6 will
> be more line-noise-ish than P5? :-p

No. Leaving out $_ is one of the important features in *reducing* line
noise. We're all very used to seeing it, but to most people it is just
two more non-alphanumeric characters.

Reducing line noise isn't my goal, though. I feel that the implicit
defaulting to $_ makes Perl a more natural and elegant language, and
would like this principle being extended to these operators.

For comparison, here is the same code snippet again. First with, and
then without explicit $_.

With:

    given ($subject) -> $_ {
        $_ ~~ s/foo/bar/;
        $_++;
        $_ x= 2;
        $_ ~= "!";
    }

Without:

    given ($subject) {
        s/foo/bar/;
        ++;
        x= 2;
        ~= "!";
    }

I think the latter is more elegant, without reducing legability or
maintainability. I also think that the code is immediately obvious, even
to people coming from Perl 5, who never read this thread.


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html

Reply via email to