nayakgi / perl-compiler

Automatically exported from code.google.com/p/perl-compiler
Other
0 stars 0 forks source link

re-eval: lexical $_ is experimental #248

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
> What steps will reproduce the problem?

1.  perl:

# perl -e '{my $s="toto";my $_="titi";{$s =~ /to(?{ print "-$_-$s-\n";})to/;}}'
-titi-toto-

2. compiled:

# perl -MO=-qq,C,-O3,-fno-fold,-ox.c -e '{my $s="toto";my $_="titi";{$s =~ 
/to(?{ print "-$_-$s-\n";})to/;}}'
# perl script/cc_harness -q x.c -o x.bin && ./x.bin
-toto--

> What is the expected output?

-titi-toto-

> What do you see instead?

-toto--

> Please use labels and text to provide additional information.

This is the TODO test in t/CORE/op/mydef.t

perl 5.14.4

CenOS 6.4 32 bit

Original issue reported on code.google.com by cpanel...@gmail.com on 2 Dec 2013 at 10:26

GoogleCodeExporter commented 9 years ago
in fact toto is the correct output 
this is not a perlcc issue but a perl issue 

Original comment by nicolas....@gmail.com on 30 Jan 2014 at 11:25

GoogleCodeExporter commented 9 years ago
Given the B::C behavior matches what perl does in later versions, we're 
lowering priority to don't care...

Original comment by todd.e.rinaldo on 31 Jan 2014 at 6:33

GoogleCodeExporter commented 9 years ago
WontFix. The usage of lexical $_ is experimental.

The right test would be 
    pcc -e '$s="toto";$_="titi";$s =~ /to(?{ print "-$_-$s-\n";})to/;'
    => -toto-toto- 
and this matches perl behavior in all versions.

$ perl5.18.2-nt -e '{my $s="toto";my $_="titi";{$s =~ /to(?{ print 
"-$_-$s-\n";})to/;}}'
Use of my $_ is experimental at -e line 1.
-titi-toto-

Original comment by reini.urban on 5 Feb 2014 at 5:23

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by reini.urban on 4 Jun 2014 at 5:14