develooper Front page | perl.perl5.porters | Postings from January 2020

Re: Idea for new warning - scalar assignment from @_

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
January 14, 2020 10:41
Subject:
Re: Idea for new warning - scalar assignment from @_
Message ID:
20200114104116.GQ9181@iabyn.com
On Mon, Jan 13, 2020 at 10:16:30PM +0100, demerphq wrote:
> On Mon, 13 Jan 2020 at 19:38, Paul "LeoNerd" Evans

[ just repeating here what I added to the github thread]

While such a warning will of course flush out possible bugs, it will also
warn on existing perfectly valid code, such as

    my $nargs = @_;

A quick CPAN grep of \$\w+\s*=\s*\@_; matches 267 distributions, and
looking at the first few hits, about 2/3 appear to be valid uses.

Coupled with code that may have done "use warnings FATAL => 'all'", there
is lots of scope for breakage of existing code. So its a -1 from me.


-- 
The warp engines start playing up a bit, but seem to sort themselves out
after a while without any intervention from boy genius Wesley Crusher.
    -- Things That Never Happen in "Star Trek" #17

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