Skip Menu |
 

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 123961
Status: open
Priority: 0/
Queue: Moose

People
Owner: Nobody in particular
Requestors: AARONRP [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: native array slice method
Download (untitled) / with headers
text/plain 399b
The "get" method of the native array trait allows only one value at a time to be returned. It would be nice if there were a "slice" method that allowed several values by index to be returned. Or, alternatively, extend the "get" method to accept multiple values. Perhaps not the _most_ important issue ever, but it seemed like an odd omission. And in general, thanks for Moose, it's really helpful!
Download (untitled) / with headers
text/plain 955b
On 2017-12-28 14:27:31, AARONRP wrote: Show quoted text
> The "get" method of the native array trait allows only one value at a > time to be returned. It would be nice if there were a "slice" method > that allowed several values by index to be returned. Or, > alternatively, extend the "get" method to accept multiple values. > > Perhaps not the _most_ important issue ever, but it seemed like an odd > omission. > > And in general, thanks for Moose, it's really helpful!
I think some sort of "multi-get" operation could make sense. We wouldn't want to extend the existing "get" because that leads to context issues like this: Foo->new( size => $obj->get(1, 2) ); # list context So we'd want a new method that is documented to always potentially return a list. Separately, I also note that we don't offer a wrapper for Perl's built-in "slice", which seems like an omission. But you wouldn't want to use it for multi-get, since it also allows mutation of the array.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.