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
UNDO always fires for while, until, loop, whenever, with/without, (others too)? #4519
Comments
From @raiphWhat I didwhile ++$ < 3 { UNDO say 'undo'; say 'done' } What I gotdone What I expecteddone What I noticedwhile, until, loop, and whenever fire the UNDO phaser for their associated block regardless of whether the block succeeds or not. $*PERL.perl.say shows version => 2015.7.1.735.g.781.c.2.c |
From @raiph
And the with/without constructs too. Maybe others? |
From @dakkarAfter some investigation, it looks like it's an interaction between the exit_handler (see Perl6::Metamodel::BOOTSTRAP) and the VM's implementation of frames (for example, MoarVM's src/core/frame.c, MVM_frame_try_return) An UNDO block fires at the end of its containing block, if the return value is "null" (nqp::isnull), not concrete, or not defined. A frame that does not return anything (as a while block seems to be) matches those conditions. On the other hand, S04 says «The value of a loop statement is the list of values from each iteration». Open questions: - should UNDO fire for void-context, or generally result-less, blocks? At the moment, this looks to me like a case of "don't do that". |
The RT System itself - Status changed from 'new' to 'open' |
From @raiph
On the assumption that it currently doesn't have sane implemented semantics it seems cromulent to say NYI for 6c. Presumably the same is true for KEEP and any other related phasers that don't work. |
From @TimToadyFixed in 02588190492349fabde00c5a15b873ea61a9333e Tested in 2f126a3ab7d0991767ca84c562b8f3ae97b25c4e There are no tests there for with or whenever, but those did not appear to misbehave when I tried them on the command line. Feel free to add more tests for those. |
1 similar comment
From @TimToadyFixed in 02588190492349fabde00c5a15b873ea61a9333e Tested in 2f126a3ab7d0991767ca84c562b8f3ae97b25c4e There are no tests there for with or whenever, but those did not appear to misbehave when I tried them on the command line. Feel free to add more tests for those. |
@TimToady - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#126005 (status was 'resolved')
Searchable as RT126005$
The text was updated successfully, but these errors were encountered: