Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #66824] "argument doesn't array" with one-item ranges

0 views
Skip to first unread message

Moritz Lenz via RT

unread,
Jun 21, 2009, 3:35:17 PM6/21/09
to perl6-l...@perl.org
On Sun Jun 21 12:05:11 2009, moritz wrote:
> 21:03 <@moritz_> rakudo: my @a = 1, 2, 4; sub f($a) { say $a };
> f(|@a[*-1..*-1])
> 21:03 < p6eval> rakudo 1b06df: OUTPUT«argument doesn't array␤in sub f
> (/tmp/2x4tmnOO68:1)␤called from Main (/tmp/2x4tmnOO68:2)␤»
>

I investigated a bit more, and found that @a[*-1..*-1] just gives 4, and
f(|4) results in the same error message. So while the current behaviour
is not very dwimmy, it is at least somewhat understandable.

What's the opinion of the p6l people? Should |@a[1..1] work? even at the
cost of allowing |1 not to be an error?

Cheers,
Moritz

0 new messages