No such thing as a small change | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
It's a bug in Rakudo that it doesn't reject the program at compile time, because $var isn't declared (yet). It's one of our oldest open bugs. Update: It should be noted though that lexical variables are always scoped to a block in Perl 6, and that the detection of of undeclared variables happens only at compile time. Thus this piece of code works differently in Perl 5 and Perl 6 (and this time Rakudo is correct here):
Here the $x is scoped to the whole mainline (which is an implicit block), so an eval sees it at runtime even though the eval comes textually before the declaration of $x. Second update: I've fixed the bug, so updating to the latest development version should give the desired behavior. The fix is a bit incomplete, but you're now much more unlikely to come across this problem. In reply to Re: Perl6 Late variable declaration allowed?
by moritz
|
|