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

'INIT take' inside of a 'gather for' yields empty result in Rakudo on JVM/Moar #3416

Closed
p6rt opened this issue Jun 16, 2014 · 4 comments
Closed
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 16, 2014

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

Searchable as RT122114$

@p6rt
Copy link
Author

p6rt commented Jun 16, 2014

From @masak

<masak> so, FIRST doesn't run if there are no iterations.
<jnthn> And nor does LAST any more.
<masak> which phaser do I use if I want to run even when there are no
iterations?
<masak> (I want to do an unconditional once-only take in a 'gather for')
<moritz> INIT?
<masak> moritz​: trying.
<masak> m​: say (gather for 1..3 { take $_ })
<camelia> rakudo-moar 6dd2e8​: OUTPUT«1 2 3␤»
<masak> m​: say (gather for 1..3 { INIT take "OH HAI"; take $_ })
<camelia> rakudo-moar 6dd2e8​: ( no output )
<masak> o.O
<masak> I...
* masak submits rakudobug
<masak> r​: say (gather for 1..3 { INIT take "OH HAI"; take $_ })
<camelia> rakudo-{jvm,moar} 6dd2e8​: ( no output )
<camelia> ..rakudo-parrot 6dd2e8​: OUTPUT«take without gather [...]»
<masak> oh.
<masak> Parrot may actually have a point.

I think outputting nothing in this case (as Moar and JVM do) is a bug.
At the very least the program should output «1 2 3␤», or fail with an
error message similar to Parrot's on all backends.

@p6rt
Copy link
Author

p6rt commented May 25, 2015

From @usev6

On Mon Jun 16 07​:26​:32 2014, masak wrote​:

[...]
* masak submits rakudobug
<masak> r​: say (gather for 1..3 { INIT take "OH HAI"; take $_ })
<camelia> rakudo-{jvm,moar} 6dd2e8​: ( no output )
<camelia> ..rakudo-parrot 6dd2e8​: OUTPUT«take without gather [...]»
<masak> oh.
<masak> Parrot may actually have a point.

I think outputting nothing in this case (as Moar and JVM do) is a bug.
At the very least the program should output «1 2 3␤», or fail with an
error message similar to Parrot's on all backends.

The evaluation fails now with X​::ControlFlow and Parrot's error message​:

$ perl6-m -e 'say (gather for 1..3 { INIT take "OH HAI"; take $_ })'
take without gather

$ perl6-j -e 'say (gather for 1..3 { INIT take "OH HAI"; take $_ })'
take without gather

I added a test to S04-statements/gather.t with commit https://rt-archive.perl.org/perl6/Ticket/Display.html?id=122114

I'm closing this ticket as 'resolved'.

@p6rt
Copy link
Author

p6rt commented May 25, 2015

The RT System itself - Status changed from 'new' to 'open'

@p6rt p6rt closed this as completed May 25, 2015
@p6rt
Copy link
Author

p6rt commented May 25, 2015

@usev6 - Status changed from 'open' to 'resolved'

@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