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

After giving Seq it's own join method, redo behaves strange in grep #5992

Closed
p6rt opened this issue Jan 8, 2017 · 8 comments
Closed

After giving Seq it's own join method, redo behaves strange in grep #5992

p6rt opened this issue Jan 8, 2017 · 8 comments
Labels
regression Issue did not exist previously testcommitted

Comments

@p6rt
Copy link

p6rt commented Jan 8, 2017

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

Searchable as RT130529$

@p6rt
Copy link
Author

p6rt commented Jan 8, 2017

From @usev6

With rakudo commit 3c52aa096c Seq got it's own join method. For some reason
that changed the behaviour of 'redo' in 'grep'​:

< bartolin> m​: my $attempts = 0; say (1..5).grep({if $_ == 3 {$attempts++; redo unless $attempts == 10}; $_}).join("|"); say "looked $attempts times for element 3"
< camelia> rakudo-moar f6303d​: OUTPUT«1|2|4|5␤looked 1 times for element 3␤»
< bartolin> star-m​: my $attempts = 0; say (1..5).grep({if $_ == 3 {$attempts++; redo unless $attempts == 10}; $_}).join("|"); say "looked $attempts times for element 3"
< camelia> star-m 2016.10​: OUTPUT«1|2|3|4|5␤looked 10 times for element 3␤»

Further discussion here​: https://irclog.perlgeek.de/perl6-dev/2017-01-08#i_13878701

@p6rt
Copy link
Author

p6rt commented Jan 8, 2017

From @usev6

On Sun, 08 Jan 2017 05​:11​:03 -0800, bartolin@​gmx.de wrote​:

With rakudo commit 3c52aa096c Seq got it's own join method. For some
reason that changed the behaviour of 'redo' in 'grep'

Also, next/redo in grep die on rakudo-j when using the new join method​:

$ ./perl6-j -e 'say (1..4).grep({next if $_ == 3; $_}).join("|")'
next without loop construct

$ $ ./perl6-j -e 'my $retries = 0; say (1..5).grep({if $_ == 3 {$retries++; redo unless $retries == 10}; $_}).join("|"); say "looked $retries times for element 3"'
redo without loop construct

Please note, that the evaluations work as expected when using perl instead of join​:

$ ./perl6-j -e 'say (1..4).grep({next if $_ == 3; $_}).perl'
(1, 2, 4).Seq

$ ./perl6-j -e 'my $retries = 0; say (1..5).grep({if $_ == 3 {$retries++; redo unless $retries == 10}; $_}).perl; say "looked $retries times for element 3"'
(1, 2, 3, 4, 5).Seq
looked 10 times for element 3

1 similar comment
@p6rt
Copy link
Author

p6rt commented Jan 8, 2017

From @usev6

On Sun, 08 Jan 2017 05​:11​:03 -0800, bartolin@​gmx.de wrote​:

With rakudo commit 3c52aa096c Seq got it's own join method. For some
reason that changed the behaviour of 'redo' in 'grep'

Also, next/redo in grep die on rakudo-j when using the new join method​:

$ ./perl6-j -e 'say (1..4).grep({next if $_ == 3; $_}).join("|")'
next without loop construct

$ $ ./perl6-j -e 'my $retries = 0; say (1..5).grep({if $_ == 3 {$retries++; redo unless $retries == 10}; $_}).join("|"); say "looked $retries times for element 3"'
redo without loop construct

Please note, that the evaluations work as expected when using perl instead of join​:

$ ./perl6-j -e 'say (1..4).grep({next if $_ == 3; $_}).perl'
(1, 2, 4).Seq

$ ./perl6-j -e 'my $retries = 0; say (1..5).grep({if $_ == 3 {$retries++; redo unless $retries == 10}; $_}).perl; say "looked $retries times for element 3"'
(1, 2, 3, 4, 5).Seq
looked 10 times for element 3

@p6rt
Copy link
Author

p6rt commented Jan 8, 2017

From @lizmat

Fixed with 362f674 , tests needed.

On 8 Jan 2017, at 14​:11, Christian Bartolomaeus (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Christian Bartolomaeus
# Please include the string​: [perl #​130529]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=130529 >

With rakudo commit 3c52aa096c Seq got it's own join method. For some reason
that changed the behaviour of 'redo' in 'grep'​:

< bartolin> m​: my $attempts = 0; say (1..5).grep({if $_ == 3 {$attempts++; redo unless $attempts == 10}; $_}).join("|"); say "looked $attempts times for element 3"
< camelia> rakudo-moar f6303d​: OUTPUT«1|2|4|5␤looked 1 times for element 3␤»
< bartolin> star-m​: my $attempts = 0; say (1..5).grep({if $_ == 3 {$attempts++; redo unless $attempts == 10}; $_}).join("|"); say "looked $attempts times for element 3"
< camelia> star-m 2016.10​: OUTPUT«1|2|3|4|5␤looked 10 times for element 3␤»

Further discussion here​: https://irclog.perlgeek.de/perl6-dev/2017-01-08#i_13878701

@p6rt
Copy link
Author

p6rt commented Jan 8, 2017

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

@p6rt
Copy link
Author

p6rt commented Jan 9, 2017

From @usev6

A test was added with Raku/roast@90c58ff0eb
I'm closing this ticket as 'resolved'.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Jan 9, 2017

From @usev6

A test was added with Raku/roast@90c58ff0eb
I'm closing this ticket as 'resolved'.

@p6rt p6rt closed this as completed Jan 9, 2017
@p6rt
Copy link
Author

p6rt commented Jan 9, 2017

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

@p6rt p6rt added regression Issue did not exist previously testcommitted labels Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Issue did not exist previously testcommitted
Projects
None yet
Development

No branches or pull requests

1 participant