Raku / old-issue-tracker

Tickets from RT
https://github.com/Raku/old-issue-tracker/issues
2 stars 1 forks source link

warning-less sub closure over a variable declared later in same scope #6246

Open p6rt opened 7 years ago

p6rt commented 7 years ago

Migrated from rt.perl.org#131307 (status was 'new')

Searchable as RT131307$

p6rt commented 7 years ago

From @zoffixznet

https://irclog.perlgeek.de/perl6-dev/2017-05-13#i_14576917

16​:35 Zoffix m​: my $x = 72; { sub foo { say $x }; foo ; my $x = 42; say $x } 16​:35 camelia rakudo-moar 83b7ac​: OUTPUT​: «(Any)␤42␤» 16​:37 TimToady should probably get the "already bound to outer symbol" warning 16​:37 m​: my $x = 72; { say $x; my $x = 42; say $x } 16​:37 camelia rakudo-moar 83b7ac​: OUTPUT​: «5===SORRY!5=== Error while compiling \␤Lexical symbol '$x' is already bound to an outer symbol;␤the implicit outer binding must be rewritten as OUTER​::\<$x>␤before you can unambiguously declare a new '$x' in this scope␤at \​:1␤------>…» 16​:38 TimToady like that one