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

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

Thread Previous
From:
Father Chrysostomos
Date:
July 24, 2016 05:38
Subject:
[perl #128719] With signatures and "my" vars: "state" variable $ymasks earlier declaration
Message ID:
rt-4.0.18-24000-1469338711-1267.128719-75-0@perl.org
# New Ticket Created by  Father Chrysostomos 
# Please include the string:  [perl #128719]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=128719 >


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


Thread Previous


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