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

repeat gets parsed as a listop if there's no while or until #141

Open
masak opened this issue Aug 8, 2012 · 0 comments
Open

repeat gets parsed as a listop if there's no while or until #141

masak opened this issue Aug 8, 2012 · 0 comments

Comments

@masak
Copy link
Collaborator

masak commented Aug 8, 2012

<masak> std: repeat { say "OH HAI" }
<p6eval> std f43a358: OUTPUT«===SORRY!===␤Undeclared routine:␤ 'repeat' used at line 1␤Check failed␤FAILED 00:00 41m␤»
<masak> hm.
<jnthn> did you mean loop?
<masak> jnthn: no, I meant to check what happens if I do 'repeat' without the 'until' or 'while' after the block.
<masak> std: repeat { say "OH HAI" } while True
<p6eval> std f43a358: OUTPUT«ok 00:00 41m␤»
<masak> I'm surprised it parses as a listop when the 'while' is not there.
<jnthn> Hmmmm.
<jnthn> Surely it doesn't backtrack there...
<masak> right.
<jnthn> std: repeat { my $x; say "OH HAI" }
<p6eval> std f43a358: OUTPUT«===SORRY!===␤Undeclared routine:␤ 'repeat' used at line 1 [...] Check failed␤FAILED 00:00 42m␤»
<jnthn> r: repeat { say "OH HAI" } # curious
<p6eval> rakudo 34e8d4: OUTPUT«===SORRY!===␤CHECK FAILED:␤Undefined routine '&repeat' called (line 1)␤»
<PerlJam> That could make for some interesting code.
<PerlJam> r: sub repeat { $^a.() }; repeat { say "hi" }
<p6eval> rakudo 34e8d4: OUTPUT«hi␤»
<jnthn> Wow!
<PerlJam> r:  sub repeat { $^a.() }; repeat { say "hi" }; my $i = 0; repeat { say "foo" } while $i++ < 3;
<p6eval> rakudo 34e8d4: OUTPUT«hi␤foo␤foo␤foo␤foo␤»
<PerlJam> good for obfuscation I guess
<masak> was gonna say.
<masak> I feel 'repeat' is a badly chosen name for that sub :P
<jnthn> I think the parser is gonna need to commit after seeing repeat, fwiw
* masak submits stdbug
* masak submits rakudobug
<masak> n: repeat { say "OH HAI" }
<p6eval> niecza v19-15-g051783d: OUTPUT«===SORRY!===␤␤Undeclared routine:␤     'repeat' used at line 1 [...] Check failed [...]
* masak submits nieczabug
* jnthn will wait for an STD fix and steal that
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