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

sink context consumes Seq generated by mutator method #5483

Closed
p6rt opened this issue Jul 24, 2016 · 5 comments
Closed

sink context consumes Seq generated by mutator method #5483

p6rt opened this issue Jul 24, 2016 · 5 comments
Labels
JVM Related to Rakudo-JVM testcommitted

Comments

@p6rt
Copy link

p6rt commented Jul 24, 2016

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

Searchable as RT128720$

@p6rt
Copy link
Author

p6rt commented Jul 24, 2016

From @usev6

There are failing (skipped) tests for rakudo-j in S32-list/unique.t and S32-list/repeated.t that fail with 'This Seq has already been iterated, and its values consumed'. An example​:

$ ./perl6-j -e 'my $a = <b b>; $a .= unique; say $a.perl'
Seq.new-consumed()

As far as I understand, the problem happens because calling the mutator method with '$a .= unique' is executed in sink context. If I wrap that code in nqp​::stmts to avoid sinking it works as expected​:

$ ./perl6-j -e 'use nqp; my $a = <b b>; nqp​::stmts($a .= unique); say $a.perl'
("b",).Seq

I took a look at the implementation of 'p6sink' for JVM and MoarVM and both implementations are calling method sink -- but maybe rakudo-m does not call it directly on the Seq?

@p6rt
Copy link
Author

p6rt commented Aug 10, 2016

From @usev6

On Sun Jul 24 01​:22​:23 2016, bartolin@​gmx.de wrote​:

There are failing (skipped) tests for rakudo-j in S32-list/unique.t
and S32-list/repeated.t that fail with 'This Seq has already been
iterated, and its values consumed'. An example​:

$ ./perl6-j -e 'my $a = <b b>; $a .= unique; say $a.perl'
Seq.new-consumed()

As far as I understand, the problem happens because calling the
mutator method with '$a .= unique' is executed in sink context. If I
wrap that code in nqp​::stmts to avoid sinking it works as expected​:

$ ./perl6-j -e 'use nqp; my $a = <b b>; nqp​::stmts($a .= unique); say
$a.perl'
("b",).Seq

I took a look at the implementation of 'p6sink' for JVM and MoarVM and
both implementations are calling method sink -- but maybe rakudo-m
does not call it directly on the Seq?

Now, this is interesting. The first evaluations works now. Probably it got fixed by one of TimToady++'s recent sink related commits.

$ ./perl6-j -e 'my $a = <b b>; $a .= unique; say $a.perl'
("b",).Seq

But there is another version of that code, that still produces a consumed Seq​:

$ ./perl6-j -e 'my $a = <b b>; $a.=unique; say $a.perl'
Seq.new-consumed()

Looks like '$a.=unique' is parsed differently than '$a .= unique'. (Something with 'dotty' instead of 'infix​: .='.)

@p6rt
Copy link
Author

p6rt commented Aug 10, 2016

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

@p6rt
Copy link
Author

p6rt commented Sep 10, 2017

From @usev6

The latter example works now as well​:

$ ./perl6-j -e 'my $a = <b b>; $a.=unique; say $a.perl'
$(("b",).Seq)

I've unfudged the skipped tests for this issue and I'm closing this ticket as 'resolved'.

@p6rt
Copy link
Author

p6rt commented Sep 10, 2017

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

@p6rt p6rt closed this as completed Sep 10, 2017
@p6rt p6rt added JVM Related to Rakudo-JVM testcommitted labels Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JVM Related to Rakudo-JVM testcommitted
Projects
None yet
Development

No branches or pull requests

1 participant