Skip to content
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

Incorrect KEEP / UNDO gets fired under certain exit conditions #1214

Open
ugexe opened this issue Oct 26, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@ugexe
Copy link
Member

commented Oct 26, 2017

I expect .print (or .say, .note, etc), which returns True, to fire the KEEP phaser.

$ perl6 -e 'for 1..5 { KEEP print(" "); UNDO print("_");  .print; }'

1_2_3_4_5_

https://irclog.perlgeek.de/perl6-dev/2017-10-26#i_15359546

@skids

This comment has been minimized.

Copy link
Contributor

commented Mar 29, 2018

Golf:

$ perl6 -e '{ KEEP print("K"); 42.Str; };'
$ perl6 -e '{ KEEP print("K"); 42; };'
K

Also this is actually being (wrongly) considered an unsuccessful block exit,
so it also affects hypothetical vars:

$ perl6 -e 'my $a = 0; { let $a = 1; KEEP print("K$_"); 42.Str; }; $a.say;' # Should print "K421"
0
$ perl6 -e 'my $a = 0; { let $a = 1; KEEP print("K$_"); 42; }; $a.say;' # Should print "K421"
K421

"sink 42" also kills it, but probably should since the block then returns Nil which is truly unsuccessful

ISTR code to short-circuit "useless use" messages when a method form is seen. That's where to start looking IMO.

@skids

This comment has been minimized.

Copy link
Contributor

commented Apr 2, 2018

The above commit was spectested when merged with HEAD and note there is a previous commit in that branch for another issue. The branch itself was kept back to avoid merge noise. I don't know if that is precisely the correct flavor of wanting to use there... that whole system confuses me a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.