Skip Menu |
Report information
Id: 129195
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: bri [at]

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)

Subject: Pointy while loop fails to pass arguments to block when lazy
Download (untitled) / with headers
text/plain 438b
$ perl6 -e '(while 42 { 42.say })[0..1]' 42 42 $ perl6 -e '(while 42 -> $f { 42.say })[0..1]' Too few positionals passed; expected 1 argument but got 0 in code at -e line 1 in block <unit> at -e line 1 least, I think it is laziness that triggers this, unless there's a more syntactical explanation. # If seems to work fine $ perl6 -e '(if 42 -> $f { 42.say })[0]' 42 $ perl6 -e '(if 42 { 42.say })[0]' 42 does with.
Download (untitled) / with headers
text/plain 545b
In we hit InfiniteLoopIter calling &!body(), if we have "while $foo" instead, we hit WhileLoopIter, which also calls &!body(). I'm not sure whether to put a flag into those iterators to run different code (one for no arguments, one for one argument), and I'm not sure what exact code to use to figure out what the amount of arguments is (&!body.count or .arity?). Other than that, we might want to duplicate both iter classes because the check for arity would probably not yet be eliminated by spesh and it could maybe become expensive?

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at