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

Changed behavior after v6.c: using “last” inside “grep” (say ^∞ .grep: { last }) #5329

Closed
p6rt opened this issue May 18, 2016 · 11 comments
Labels
RFC Request For Comments

Comments

@p6rt
Copy link

p6rt commented May 18, 2016

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

Searchable as RT128181$

@p6rt
Copy link
Author

p6rt commented May 18, 2016

From @AlexDaniel

Code​:
say ^â�� .grep​: { last }

Result (2016.01)​:
()

Result (HEAD)​:
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...)

Coke++ has managed to find (git bisect) commit that caused this problem​: rakudo/rakudo@6d120ca

I don't know which behavior is right. However, take a look at the next example​:

Code​:
say ^� .grep({ last }).elems

Result (2016.01)​:
(nothing, it hangs!)

In other words, even previous behavior was not �right� in all cases.

@p6rt
Copy link
Author

p6rt commented May 19, 2016

From @coke

On Wed May 18 14​:21​:32 2016, alex.jakimenko@​gmail.com wrote​:

Coke++ has managed to find (git bisect) commit that caused this
problem​:
rakudo/rakudo@6d120ca

I actually found the difference of a similar but not quite exactly the same piece of code; However there is a very good chance this is still the commit responsible.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Dec 16, 2016

From @AlexDaniel

From outdated design docs​:
�Note that grep is an implicit loop, so next and last without an argument will iterate or terminate the grep itself, not some loop surrounding the statement containing the grep�

OK, so 「last」 in grep is supposed to work. And it did�

Code​:
say (^Inf).grep({last if $_ > 5; True})[^20]

Result (2016.02)​:
(0 1 2 3 4 5 Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil)

Result (HEAD)​:
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19)

Bisectable points to rakudo/rakudo@6d120ca

@p6rt
Copy link
Author

p6rt commented Dec 16, 2016

From @lizmat

Preliminary fix for 2016.12 made in 7021861705f03b105d . Proper fix will happen after the release. Tests are still needed.

On 16 Dec 2016, at 23​:43, Aleks-Daniel Jakimenko-Aleksejev (via RT) <perl6-bugs-followup@​perl.org> wrote​:

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

From outdated design docs​:
�Note that grep is an implicit loop, so next and last without an argument will iterate or terminate the grep itself, not some loop surrounding the statement containing the grep�

OK, so 「last」 in grep is supposed to work. And it did�

Code​:
say (^Inf).grep({last if $_ > 5; True})[^20]

Result (2016.02)​:
(0 1 2 3 4 5 Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil Nil)

Result (HEAD)​:
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19)

Bisectable points to rakudo/rakudo@6d120ca

@p6rt
Copy link
Author

p6rt commented Dec 16, 2016

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

@p6rt
Copy link
Author

p6rt commented Dec 28, 2016

From @moritz

There's now a test for last in grep on an infinite list​: Raku/roast@9b1a7cb528

As you see in the context of this diff, there was a test for last in grep already, though on a finite list.

Liz, you mentioned a proper fix forthcoming. Should I keep this ticket open until the proper fix is in?

1 similar comment
@p6rt
Copy link
Author

p6rt commented Dec 28, 2016

From @moritz

There's now a test for last in grep on an infinite list​: Raku/roast@9b1a7cb528

As you see in the context of this diff, there was a test for last in grep already, though on a finite list.

Liz, you mentioned a proper fix forthcoming. Should I keep this ticket open until the proper fix is in?

@p6rt
Copy link
Author

p6rt commented Dec 28, 2016

From @lizmat

The proper fix was even committed before the last release, so yes this ticket can be closed as far as I�m concerned. moritz++

On 28 Dec 2016, at 10​:28, Moritz Lenz via RT <bugs-comment@​bugs6.perl.org> wrote​:

There's now a test for last in grep on an infinite list​: Raku/roast@9b1a7cb528

As you see in the context of this diff, there was a test for last in grep already, though on a finite list.

Liz, you mentioned a proper fix forthcoming. Should I keep this ticket open until the proper fix is in?

@p6rt
Copy link
Author

p6rt commented Dec 31, 2016

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

@p6rt
Copy link
Author

p6rt commented Feb 27, 2017

From @AlexDaniel

RT #​130365 was actually a dup of this ticket. Therefore, this can be closed.

On 2016-05-19 08​:20​:38, coke wrote​:

On Wed May 18 14​:21​:32 2016, alex.jakimenko@​gmail.com wrote​:

Coke++ has managed to find (git bisect) commit that caused this
problem​:
rakudo/rakudo@6d120ca

I actually found the difference of a similar but not quite exactly the
same piece of code; However there is a very good chance this is still
the commit responsible.

@p6rt
Copy link
Author

p6rt commented Feb 27, 2017

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

@p6rt p6rt closed this as completed Feb 27, 2017
@p6rt p6rt added the RFC Request For Comments label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC Request For Comments
Projects
None yet
Development

No branches or pull requests

1 participant