Ticket #1198 (closed bug: fixed)
interactive mode doesn't save lexicals correctly
|Reported by:||kjs||Owned by:||pmichaud|
when running a language in interactive mode, and you declare a local variable, then this local variable cannot be accessed afterwards.
This is true for perl 6 as well:
my $var = 1;
say $var; No scope found for PAST::Var '$var'
Maybe for Perl 6 this is ok, but many other languages, such as Lua and Python, this should work.
Somehow, this makes sense, when looking at the generated PIR. For each input line, a new (anonymous) sub is generated and executed. Any local declarations are local to that sub, and are lost after that point.