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

[perl #132397] Deparse -x3 loses "for" initialiser

From:
Chris Wagner via RT
Date:
February 5, 2019 00:59
Subject:
[perl #132397] Deparse -x3 loses "for" initialiser
Message ID:
rt-4.0.24-15342-1549328356-972.132397-15-0@perl.org
This is still an issue in 5.29.8.

for($i = 5; $i != 10; $i++) { print $i, "\n"; }

deparse:
while ( ( $i != 10 ) ) { print( $i, "\n" ); } continue { ( ++$i ) } 


for(my $i = 5; $i != 10; $i++) { print $i, "\n"; }

deparse:
while ( ( $i != 10 ) ) { print( $i, "\n" ); } continue { ( ++$i ) }


This problem goes back to atleast 5.8.8.

$ /c/perl588/bin/perl5.8.8.exe -e 'print $]'
5.008008

$ /c/perl588/bin/perl5.8.8.exe -MO=Deparse,-p,-q,-x9,-P -e 'for(my$i = 5; $i != 10; $i++) { print $i, "\n"; }'
-e syntax OK
while (($i != 10)) {
    print($i, "\n");
}
continue {
    (++$i)
}


Thanks.


---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=132397



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