develooper Front page | perl.perl5.porters | Postings from August 2016

Re: [perl #128719] With signatures and "my" vars: "state" variable$y masks earlier declaration

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
August 10, 2016 15:53
Subject:
Re: [perl #128719] With signatures and "my" vars: "state" variable$y masks earlier declaration
Message ID:
20160810155348.GB3173@iabyn.com
On Mon, Jul 25, 2016 at 09:08:15AM +0100, Dave Mitchell wrote:
> On Sat, Jul 23, 2016 at 10:39:34PM -0700, Father Chrysostomos via RT wrote:
> > On Sat Jul 23 22:38:31 2016, sprout wrote:
> > > This behaves as expected:
> > > 
> > > $ ./perl -Ilib -we 'my $y if 0; my $y'
> > > Deprecated use of my() in false conditional at -e line 1.
> > > "my" variable $y masks earlier declaration in same scope at -e line 1.
> > > 
> > > If I accomplish the same thing inside a subroutine signature, I get
> > > the wrong warning:
> > > 
> > > $ ./perl -Ilib -wE 'use experimental "signatures"; sub foo($x=0 && my
> > > $y, $y=1) {}'
> > > Deprecated use of my() in false conditional at -e line 1.
> > > "state" variable $y masks earlier declaration in same scope at -e line
> > > 1.
> > > 
> > > There is no state variable there.
> > > 
> > > I get the same results from 5.20.1 to 5.25.3.
> > 
> > The ‘my in false conditional’ is unrelated.  I just came across this bug when experimenting with that.
> > 
> > $ ./perl -Ilib  -wE 'use experimental "signatures"; sub foo($y, $y) {}'
> > "state" variable $y masks earlier declaration in same scope at -e line 1.
> 
> I'll look into fixing this in my sig branch

Now fixed by v5.25.3-118-gd79f31b

-- 
Counsellor Troi states something other than the blindingly obvious.
    -- Things That Never Happen in "Star Trek" #16

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