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

Sequence examples no longer work as advertised / section could use improvement #444

Closed
dod38fr opened this issue Apr 6, 2016 · 3 comments
Labels
docs Documentation issue (primary issue type) update part of "docs" - indicates this is an update for an existing section; rewrite, clarification, etc.

Comments

@dod38fr
Copy link

dod38fr commented Apr 6, 2016

Hello

In page http://doc.perl6.org/language/list#Sequences , the following example:

  my @s := (loop { 42.say }); # Error expected Positional but got Seq

triggers an endlees loop instead of the error mentioned in comment (tested with rakudo 2016.03).

Although I can't say if this is a bug or a documentation error.

All the best

@zoffixznet
Copy link
Contributor

Looks like that whole section needs to be rewritten. None of the examples with binding produce described results, so I think the behavior of loop in such form has changed.

Also, using only the loop {...} to make a sequence leaves out much neater things like the sequence operator: 0, 2 ... * might be a better example to use, or at least it should be mentioned. It also works with the binding examples, although the part demonstrating how elements get generated becomes undemonstrative.

@zoffixznet zoffixznet changed the title Sequence example triggers an endless loop instead of error Sequence examples no longer work as advertized / section could use improvement Apr 6, 2016
@zoffixznet zoffixznet added docs Documentation issue (primary issue type) affects content labels Apr 6, 2016
@JJ JJ changed the title Sequence examples no longer work as advertized / section could use improvement Sequence examples no longer work as advertised / section could use improvement Apr 17, 2018
@JJ JJ added the update part of "docs" - indicates this is an update for an existing section; rewrite, clarification, etc. label Apr 17, 2018
@JJ
Copy link
Contributor

JJ commented Apr 17, 2018

That page has evolved, and that particular example works as advertised. Can you please check if it's OK now, or suggest changes?

@zoffixznet
Copy link
Contributor

This example is wrong:

my @s := Seq.new(<a b c>); CATCH { default { say .^name, ' ', .Str } }
# OUTPUT «Type check failed in binding to $iter; expected Iterator but got List ($("a", "b", "c"))␤  in block <unit> at <tmp> line 1␤␤» 

It's trying to show that you can't bind a Seq to a Positional variable, but it's constructing the Seq incorrectly and gets the wrong error. It's meant to be <a b c>.Seq and then the error message will be different; actually saying that you can't bind stuff.

Although I can't say if this is a bug or a documentation error.

It's a known bug. IIRC it's trying to reify the Seq with .perl to show a bit of its guts in the error message and ends up reifying forever.

@JJ JJ added the JJ TPF Grant label May 4, 2018
@JJ JJ added this to the May SQUASHathon milestone May 4, 2018
@JJ JJ closed this as completed in 88a1c85 May 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation issue (primary issue type) update part of "docs" - indicates this is an update for an existing section; rewrite, clarification, etc.
Projects
None yet
Development

No branches or pull requests

4 participants