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

Binding a Seq to a @ variable tries to consume it first #6427

Open
p6rt opened this issue Aug 5, 2017 · 4 comments
Open

Binding a Seq to a @ variable tries to consume it first #6427

p6rt opened this issue Aug 5, 2017 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Aug 5, 2017

Migrated from rt.perl.org#131845 (status was 'open')

Searchable as RT131845$

@p6rt
Copy link
Author

p6rt commented Aug 5, 2017

From @zoffixznet

Since Seq is not a Positional type, *binding* it to a `@​` variable is typecheck error​:

13​:26 m​: my @​a := Seq.new​: class :​: does Iterator {method pull-one {IterationEnd}}.new;
13​:26 camelia rakudo-moar abf1cf​: OUTPUT​: «Type check failed in binding; expected Positional but got Seq ($(().Seq))? in block <unit> at <tmp> line 1??»

However, it appears the code is trying to consume the entire Seq, before generating the error​:

13​:26 Zoffix m​: my @​a := Seq.new​: class :​: does Iterator {method pull-one {42}}.new; # hang
13​:27 camelia rakudo-moar abf1cf​: OUTPUT​: «(timeout)»
13​:31 Zoffix m​: my @​a := 1…?; # but this one has `is-lazy` set
13​:31 camelia rakudo-moar abf1cf​: OUTPUT​: «Type check failed in binding; expected Positional but got Seq (?)? in block <unit> at <tmp> line 1??»

Perhaps it thinks it's gonna do assignment and consumes non-lazy Seqs in preparation for it, but then the binding happens and then it throws?

@p6rt
Copy link
Author

p6rt commented Aug 7, 2017

From @AlexDaniel

Not sure if this info is relevant now, but the hang was introduced in (2016-02-18) rakudo/rakudo@9983c2c

On 2017-08-05 06​:33​:14, cpan@​zoffix.com wrote​:

Since Seq is not a Positional type, *binding* it to a `@​` variable is
typecheck error​:

13​:26 m​: my @​a := Seq.new​: class :​: does Iterator {method
pull-one {IterationEnd}}.new;
13​:26 camelia rakudo-moar abf1cf​: OUTPUT​: «Type check failed in
binding; expected Positional but got Seq ($(().Seq))? in block <unit>
at <tmp> line 1??»

However, it appears the code is trying to consume the entire Seq,
before generating the error​:

13​:26 Zoffix m​: my @​a := Seq.new​: class :​: does Iterator {method
pull-one {42}}.new; # hang
13​:27 camelia rakudo-moar abf1cf​: OUTPUT​: «(timeout)»
13​:31 Zoffix m​: my @​a := 1…?; # but this one has `is-lazy` set
13​:31 camelia rakudo-moar abf1cf​: OUTPUT​: «Type check failed in
binding; expected Positional but got Seq (?)? in block <unit> at
<tmp> line 1??»

Perhaps it thinks it's gonna do assignment and consumes non-lazy Seqs
in preparation for it, but then the binding happens and then it
throws?

@p6rt
Copy link
Author

p6rt commented Aug 7, 2017

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

@p6rt
Copy link
Author

p6rt commented Aug 10, 2017

From @zoffixznet

On Sun, 06 Aug 2017 18​:52​:07 -0700, alex.jakimenko@​gmail.com wrote​:

Not sure if this info is relevant now, but the hang was introduced in
(2016-02-18)
rakudo/rakudo@9983c2c

Yes, very relevant. It's the .perl that hangs and even in non-hanging cases it has the potential to perform huge amounts of work, just to throw it all-but-first-score of chars.

I see a bunch of other exceptions use .perl and are probably subject to the same issue. I'd say this is another face of some meta ticket for "Errors of Rakudo — The Full Picture"; discussion for which is currently happening on this ticket​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=131877#txn-1480778

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant