On Sat, May 11, 2013 at 7:10 AM, Will Coleda via RT < perl6-bugs-follo...@perl.org> wrote:
> On Sun Oct 16 03:56:13 2011, masak wrote: > > <masak> nom: my $c; my $name; BEGIN { $c = { say "OH HAI $name" } }; > > $name = "masak"; $c() > > <p6eval> nom ea25f3: OUTPUT«Use of uninitialized value in string > > contextOH HAI » > > <masak> I'd expect the above to say "OH HAI masak". > > <masak> are my expectations too high? :) > > <jnthn> masak: Seems reasonableish... :) > > * masak submits rakudobug > > I would expect $name to be undefined at BEGIN time, which would make this > behavior correct. > > Can you explain your POV here? > But $name is declared at BEGIN time and defined at $c() time. Observe Perl 5: $ perl -E 'my $c; my $name; BEGIN { $c = sub { say "OH HAI $name" } }; $name = "masak"; $c->()' OH HAI masak $ If I drop the $c(), I get no warning, so the interpolation of $name is not happening at BEGIN time. So ... the block is not closing as expected over $name? It's trying to interpolate something other than the declared $name? Eirik