On Fri, Mar 29, 2013 at 10:32:53AM -0700, Chris Weyl wrote:
> On Fri, Mar 29, 2013 at 9:35 AM, Jesse Luehrs <[email protected]> wrote:
>
> > On Fri, Mar 29, 2013 at 09:30:59AM -0700, Chris Weyl wrote:
> > > On Thu, Mar 28, 2013 at 10:34 AM, Jesse Luehrs <[email protected]> wrote:
> > >
> > > > On Thu, Mar 28, 2013 at 06:23:55PM +0100, curtis_ovid_poe wrote:
> > > > > Is the idea of deprecating alias and excludes just speculation, or is
> > > > > this the plan for the future?
> > > >
> > > > It has always been my plan, but it's been a while since I discussed it
> > > > with anyone.
> > > >
> > >
> > > Why would we do that? Those are extremely useful features, and I'm
> > having
> > > a hard time visualizing a benefit to removing method aliasing and
> > exclusion.
> >
> > What do you use them for?
> >
>
> One example would be an extension in providing a new native trait accessor
> type... (that I've had hanging out in an attic branch forever):
>
> https://gist.github.com/c29c165e1aacda7018a5
>
> Aliasing allows me to trivially shunt one method aside and create a new one
> in its place w/o having to resort to method modifiers.
As I described earlier, this works fine:
package Moose::Meta::Method::Accessor::Native::Hash::grep_keys;
use Moose::Role 1.15;
with
'Moose::Meta::Method::Accessor::Native::Array::grep',
'Moose::Meta::Method::Accessor::Native::Hash',
;
sub _return_value {
my ($self, $slot_access) = @_;
return
$self->Moose::Meta::Method::Accessor::Native::Array::grep::_return_value("[
keys %{ $slot_access } ]");
}
no Moose::Role;
1;
-doy