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

andthen=, notandthen=, and orelse= thunk incorrectly and don't alias $_ #6382

Open
p6rt opened this issue Jul 5, 2017 · 1 comment
Open
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 5, 2017

Migrated from rt.perl.org#131710 (status was 'new')

Searchable as RT131710$

@p6rt
Copy link
Author

p6rt commented Jul 5, 2017

From @zoffixznet

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

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant