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
'return' invoked outside of a routine should throw an exception #3480
Comments
From @masak<moritz> m: -> $f, $s { return $f + $s }(23, 42) |
From @pmichaudPer further discussion on #perl6... By definition, I think that "lexotic" sharply limits what can be done statically. If a C<return> (inside of a block) isn't lexically scoped, it's dynamically scoped. About the only place it could be caught statically is as a bare 'return' inside of a mainline (and even there, I'm wondering if there is a case where a mainline might dynamically be invoked from inside of a Routine). However, a return that is invoked dynamically outside of any Routine should throw a runtime error, so I'm changing the topic of this ticket to match that. Pm |
The RT System itself - Status changed from 'new' to 'open' |
From @lizmat[14:22:01] <lizmat> m: my $a = do { return 42 } |
From @smlsA `return` outside a routine now always seems to throw a run-time error, as it should: $ perl6 -e 'return' $ perl6 -e '{ return }' $ MVM_SPESH_DISABLE=1 perl6 -e '{ return }' Bisectable points to this fix from Dec 2015: https://gist.github.com/Whateverable/63b5da597e229d167d8708a43d4501de This ticket can be closed once tests are added to roast. |
From @skidsOn Sun, 10 Sep 2017 11:22:29 -0700, smls75@gmail.com wrote:
It looks to me like the tests already in S04-statements/return.t should suffice, no? (This appears to be another case where a bug filed and fixed during the Since MVM_* environment variables are not part of the Perl 6 specification, |
From @smls
You're right. Closing the ticket. |
@smls - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#122504 (status was 'resolved')
Searchable as RT122504$
The text was updated successfully, but these errors were encountered: