develooper Front page | perl.perl6.language | Postings from March 2009

Re: [perl #62528] Match.keys method returns nothing.

Thread Next
Moritz Lenz
March 29, 2009 12:10
Re: [perl #62528] Match.keys method returns nothing.
Message ID:
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?


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About