Navigation Menu

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

Internal error talking about coroutines when combining recursion and gather in Rakudo #3114

Closed
p6rt opened this issue Apr 25, 2013 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Apr 25, 2013

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

Searchable as RT117763$

@p6rt
Copy link
Author

p6rt commented Apr 25, 2013

From @masak

<cognominal> stuck anew with the same message; no return in the gather
though. https://gist.github.com/cognominal/5458754
<moritz> curious, I get "get_attr_str() not implemented in class 'Coroutine'"
<moritz> with cognominal's code
<cognominal> can we use gather in a recursive setting?
<cognominal> r​: sub a($n) { gather { take $n; take $n-1 if $n != 0
}}; say a(2);
<camelia> rakudo 37c995​: OUTPUT«2 1␤»
<cognominal> This simpler recursion case works
<masak> moritz​: I'm getting the same.
<masak> minimizing.
<moritz> cognominal​: iirc [Coke] has hit another limitation of
gather/take recentely; if you reuse the same gather/take block, the
first iterator has to be exhausted before the second one is started
<cognominal> arf
<masak> r​: sub p(*@​l) { gather { if @​l == 1 { take @​l } else {
@​l.shift; for p(@​l) -> @​p {} } } }; say p 1..4
<camelia> rakudo 37c995​: OUTPUT«get_attr_str() not implemented in
class 'Coroutine' [...]
<masak> there we go.
* masak submits rakudobug
<moritz> for p(@​l) -> @​p
<moritz> 'for' flattens, so if p(@​l) returns a list of arrays of
integers, that's what you get
<masak> moritz​: yes, I know.
<masak> moritz​: the internal error seems to happen before that, though.

@p6rt
Copy link
Author

p6rt commented Jun 19, 2015

From @usev6

I tried the evaluation from this bug report and didn't get that internal error anymore. There is still a type check error, though (which looks plausible to me)​:

$ perl6-m -e 'sub p(*@​l) { gather { if @​l == 1 { take @​l } else { @​l.shift; for p(@​l) -> @​p {} } } }; say p 1..4'
Type check failed in binding @​p; expected 'Positional' but got 'Int'
  in block at -e​:1

If I change @​p to a scalar container $p, the code does not die​:

$ perl6-m -e 'sub p(*@​l) { gather { if @​l == 1 { take @​l } else { @​l.shift; for p(@​l) -> $p {} } } }; say p 1..4; say "alive"'

alive

I'm not quite sure how a proper test for this ticket would look like. Just testing for X​::TypeCheck?

1 similar comment
@p6rt
Copy link
Author

p6rt commented Jun 19, 2015

From @usev6

I tried the evaluation from this bug report and didn't get that internal error anymore. There is still a type check error, though (which looks plausible to me)​:

$ perl6-m -e 'sub p(*@​l) { gather { if @​l == 1 { take @​l } else { @​l.shift; for p(@​l) -> @​p {} } } }; say p 1..4'
Type check failed in binding @​p; expected 'Positional' but got 'Int'
  in block at -e​:1

If I change @​p to a scalar container $p, the code does not die​:

$ perl6-m -e 'sub p(*@​l) { gather { if @​l == 1 { take @​l } else { @​l.shift; for p(@​l) -> $p {} } } }; say p 1..4; say "alive"'

alive

I'm not quite sure how a proper test for this ticket would look like. Just testing for X​::TypeCheck?

@p6rt
Copy link
Author

p6rt commented Jun 19, 2015

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

@p6rt
Copy link
Author

p6rt commented Aug 29, 2015

From @coke

On Fri Jun 19 12​:57​:49 2015, bartolin@​gmx.de wrote​:

I tried the evaluation from this bug report and didn't get that
internal error anymore. There is still a type check error, though
(which looks plausible to me)​:

$ perl6-m -e 'sub p(*@​l) { gather { if @​l == 1 { take @​l } else {
@​l.shift; for p(@​l) -> @​p {} } } }; say p 1..4'
Type check failed in binding @​p; expected 'Positional' but got 'Int'
in block at -e​:1

If I change @​p to a scalar container $p, the code does not die​:

$ perl6-m -e 'sub p(*@​l) { gather { if @​l == 1 { take @​l } else {
@​l.shift; for p(@​l) -> $p {} } } }; say p 1..4; say "alive"'

alive

I'm not quite sure how a proper test for this ticket would look like.
Just testing for X​::TypeCheck?

Behavior changes in GLR​:
09​:05 < [Coke]> m​: sub p(*@​l) { gather { if @​l == 1 { take @​l } else { @​l.shift; for p(@​l) -> @​p {} } } }; say p 1..4
09​:05 < GLRelia> rakudo-moar 966096​: OUTPUT«␤»
09​:05 <+camelia> rakudo-moar fd1612​: OUTPUT«Type check failed in binding @​p; expected 'Positional' but got 'Int'␤ in block at
  /tmp/SqXtcgfOAz​:1␤ in block <unit> at /tmp/SqXtcgfOAz​:1␤␤»

--
Will "Coke" Coleda

@p6rt p6rt closed this as completed Apr 7, 2016
@p6rt
Copy link
Author

p6rt commented Apr 7, 2016

@diakopter - 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