[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl6-language
Subject:    [perl #66824] "argument doesn't array" with one-item ranges
From:       "Moritz Lenz via RT" <perl6-bugs-followup () perl ! org>
Date:       2009-06-21 19:35:17
Message-ID: rt-3.6.HEAD-2145-1245612915-1857.66824-15-0 () perl ! org
[Download RAW message or body]

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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic