develooper Front page | perl.perl5.porters | Postings from February 2013

Re: Salvaging lexical $_ from deprecation

Thread Previous | Thread Next
From:
Tom Christiansen
Date:
February 20, 2013 17:05
Subject:
Re: Salvaging lexical $_ from deprecation
Message ID:
22333.1361379902@chthon
Eirik Berg Hanssen <Eirik-Berg.Hanssen@allverden.no> 
    wrote on Wed, 20 Feb 2013 17:11:49 +0100:

>On Wed, Feb 20, 2013 at 3:48 PM, Ruslan Zakirov <ruz@bestpractical.com>wrote:

>> Also, this whole thread misses the fact that $a and $b used in sort
>> fall into pretty much the same basket.
>>

>  I don't think I've formulated this before, but ...

>  When I see C<< my $a >> or C<< my $b >>, I see a bug waiting to happen,
> if not already happening.

>  When I see C<< my $_ >>, I see a bug waiting to happen, or quite likely,
> already happening.

>  So much code, core and user, is expecting these variables to be globals.
> Surprise that code at your own peril.

Well put!

Let us not forget that every given() does this, too, which is part of
why it is so often broken.

--tom

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About