niecza
niecza copied to clipboard
`repeat` gets parsed as a listop if there's no `while` or `until`
<masak> std: repeat { say "OH HAI" }
<p6eval> std f43a358: OUTPUT«===SORRY!===Undeclared routine: 'repeat' used at line 1Check failedFAILED 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 failedFAILED 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«hifoofoofoofoo»
<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