Skip Menu |
Report information
Id: 131710
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: cpan [at] zoffix.com
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: [BUG] andthen=, notandthen=, and orelse= thunk incorrectly and don't alias $_
Download (untitled) / with headers
text/plain 923b
The three ops normally do .b thunks where you can give a block to RHS and it'll be used instead of the thunk: <Zoffix_> m: (my $x = 42) andthen -> $a is rw { $a = $a.say }; dd $x <camelia> rakudo-moar d39f7b: OUTPUT: «42␤Bool $x = Bool::True␤» However, the `=` meta assign op makes a .t thunk and so the block ends up being a value: <Zoffix_> m: (my $x = 42) andthen= -> $a { .say }; dd $x <camelia> rakudo-moar d39f7b: OUTPUT: «Block $x = -> $a { #`(Block|46219400) ... }␤» Also, the ops in meta assign form don't get the $_ set to the LHS's value: <Zoffix_> m: (my $x = 42) andthen= .say <camelia> rakudo-moar d39f7b: OUTPUT: «(Any)␤» <Zoffix_> m: $ orelse= .say <camelia> rakudo-moar d39f7b: OUTPUT: «(Any)␤» <Zoffix_> m: $ notandthen= .say <camelia> rakudo-moar d39f7b: OUTPUT: «(Any)␤» Bug find: https://irclog.perlgeek.de/perl6/2017-07-05#i_14831105


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org