Moritz Lenz wrote:
> Since afaict this is not specced, I'll hand that over to p6l.
>
> Eric Hodges (via RT) wrote:
>> use v6;
>>
>> rule test {test};
>>
>> "test" ~~ /<test>/;
>> say '$/.keys => ', $/.keys.perl;
>> say '%($/).keys => ', %($/).keys.perl;
>>
>> # outputs
>> # $/.keys => []
>> # %($/).keys => ["test"]
>>
>>
>> Same could be said for .values and .kv
>>
>> It would be very DWIM for it to act like a hash in these cases by default.
>
> Actually I think it would DWIM more in the general case if Match.keys
> (and .kv, .pairs, .values etc) would give a list of the array and hash
> part, so $/.keys would be  @($/).keys, %($/).keys.
> Your suggestion would be just a degenerate case of that.
>
> Any thoughts on that?

Take it one step more general: IIRC, Match returns a Capture of the
matches found.  What happens if you apply .keys, .values, etc.
directly to a Capture object?  I'm thinking that it should return a
multidimensional array: e.g., "(@$capture; %$capture).¬ękeys".

-- 
Jonathan "Dataweaver" Lang

Reply via email to