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

Failures don't get sunk when last in for loop #6355

Closed
p6rt opened this issue Jun 22, 2017 · 5 comments
Closed

Failures don't get sunk when last in for loop #6355

p6rt opened this issue Jun 22, 2017 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 22, 2017

Migrated from rt.perl.org#131622 (status was 'resolved')

Searchable as RT131622$

@p6rt
Copy link
Author

p6rt commented Jun 22, 2017

From @zoffixznet

The .map gets special treatment if it's the last item of a for loop and it gets sunk so that it gets evaluated​:

  m​: for 1 { ^2 .map​: *.say }
  rakudo-moar 86e7b2​: OUTPUT​: «0␤1␤»

We need to add the same special treatment for Failures, as they fail to explode because they never get sunk​:

  m​: for 1 { +'x' }
  rakudo-moar 86e7b2​: OUTPUT​: «WARNINGS for <tmp>​:␤Useless use of "+" in expression "+'x'" in sink context (line 1)␤»
 
  m​: +'x' for 1
  rakudo-moar 86e7b2​: OUTPUT​: «WARNINGS for <tmp>​:␤Useless use of "+" in expression "+'x'" in sink context (line 1)␤»

@p6rt
Copy link
Author

p6rt commented Oct 21, 2017

From @zoffixznet

More examples​:

  <Zoffix__> m​: sub mv { for 1 { Failure.new }; 42 }();
  <camelia> rakudo-moar 765dd6944​: OUTPUT​: «Failed␤ in sub mv at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
  <Zoffix__> m​: sub mv { for 1 { +'x' }; 42 }();
  <camelia> rakudo-moar 765dd6944​: OUTPUT​: «WARNINGS for <tmp>​:␤Useless use of "+" in expression "+'x'" in sink context (line 1)␤»

The first one manages to sink and explode Failure, the second one does not.

@p6rt
Copy link
Author

p6rt commented Jan 3, 2018

From @zoffixznet

Related Issue​: rakudo/rakudo#1360

@p6rt
Copy link
Author

p6rt commented Feb 26, 2018

From @zoffixznet

On Wed, 03 Jan 2018 10​:51​:49 -0800, cpan@​zoffix.com wrote​:

Related Issue​: rakudo/rakudo#1360

Fix​: rakudo/rakudo@4c5b81fedb7434b235
Test​: Raku/roast@01b59fb

@p6rt
Copy link
Author

p6rt commented Feb 26, 2018

@zoffixznet - Status changed from 'new' to 'resolved'

@p6rt p6rt closed this as completed Feb 26, 2018
@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