-
Notifications
You must be signed in to change notification settings - Fork 577
ref to variable not kept by nested closure #8400
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
Comments
From [email protected]Created by [email protected]Run the following test case. sub handler(&) { my $call; { my $test1 = "foo"; $call->(); Perl Info
|
From @ysthOn Tue, Apr 11, 2006 at 05:32:01AM -0700, Hervé Guillemet wrote:
This is fixed in bleadperl, but probably won't be in 5.8.x. sub handler(&) { my $call; { my $test1 = "foo"; $call->(); |
The RT System itself - Status changed from 'new' to 'open' |
@rgs - Status changed from 'open' to 'resolved' |
From [email protected]This is a bug report for perl from adb@enki.net, This is perhaps best illustrated with a short test case: $ perl -Wle '{ my $a = 1; sub b { sub { print $a } }} &{b()}' $ perl -Wle '{ my $a = 1; sub b { my $c = $a; sub { print $a } }} &{b()}' That is, if I define one closure inside another inside an outer block, It seems like Perl is trying to optimize by throwing away lexical This comes from a real-world problem: I've got a function that scans I have a workaround, gratuitously referencing the query variables in $ ruby -We 'proc { a = 1; proc { proc { puts a } } }.call.call.call;' I don't believe Perl should take such shortcuts with closures. I'd be Flags: Site configuration information for perl v5.8.8: Configured by Debian Project at Sun Aug 6 17:22:11 UTC 2006. Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Locally applied patches: @INC for perl v5.8.8: Environment for perl v5.8.8: |
From @mhxOn 2006-12-08, at 08:34:08 -0800, Aaron D.Ball (via RT) wrote:
I don't think it's a "Feature", and it has apparently been mhx@r2d2 ~ $ bleadperl -Wle '{ my $a = 1; sub b { sub { print $a } }} &{b()}' mhx@r2d2 ~ $ bleadperl -v This is perl, v5.9.5 DEVEL29485 built for i686-linux-64int-ld Marcus -- |
From @iabynOn Fri, Dec 08, 2006 at 07:21:09PM +0100, Marcus Holland-Moritz wrote:
Yep: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2003-02/msg01109.html * named subs now close on behalf of inner subs; -- |
From [email protected]Marcus Holland-Moritz via RT wrote:
Yeah, I saw that when doing followup, so I merged my bug into the older I just rsynced perl-current and am building a local Debian package to |
From [email protected]Aaron D. Ball did write:
[...]
Highly likely. blead is a pun on leading edge/bleeding edge. Running -- |
Migrated from rt.perl.org#38895 (status was 'resolved')
Searchable as RT38895$
The text was updated successfully, but these errors were encountered: