You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ 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
...at 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
In Seq.pm 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?
Migrated from rt.perl.org#129195 (status was 'open')
Searchable as RT129195$
The text was updated successfully, but these errors were encountered: