Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With signatures and "my" vars: "state" variable $y masks earlier declaration #15472

Closed
p5pRT opened this issue Jul 24, 2016 · 6 comments
Closed

Comments

@p5pRT
Copy link

p5pRT commented Jul 24, 2016

Migrated from rt.perl.org#128719 (status was 'resolved')

Searchable as RT128719$

@p5pRT
Copy link
Author

p5pRT commented Jul 24, 2016

From @cpansprout

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.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jul 24, 2016

From @cpansprout

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.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jul 24, 2016

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jul 25, 2016

From @iabyn

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

--
The optimist believes that he lives in the best of all possible worlds.
As does the pessimist.

@p5pRT
Copy link
Author

p5pRT commented Aug 10, 2016

From @iabyn

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

@p5pRT
Copy link
Author

p5pRT commented Aug 10, 2016

@cpansprout - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant