On Thu, Jul 23, 2009 at 12:21 AM, Goro Fuji<g.psy...@gmail.com> wrote: > Hi, > > I wonder why Role inherits methods from Class. > > Even if a role is not a Class, we can override the can() method. > > package Moose::Meta::Role; > our @ISA = qw(Class::MOP::Class); > sub isa{ > my($self, $class) = @_; > return $self->SUPER::isa($class) && (ref $self || $self) ne > 'Class::MOP::Class'; > } > > Now Role acts as Class, but not is-a Class. > -- > Goro Fuji (gfx) >
Bleh. This is distasteful if for no other reason than it goes against the very thing I've been arguing about with regards to Roles for Behavior and Classes for Taxonomy. True we don't have Traits in CMOP (yet) and we don't use them in Moose (yet) ... but the plan is eventually we will and this kind of inheritance-for-code-reuse thing will only need to be revisited then. We already have a common set of package that both Moose::Meta::Class and Moose::Meta::Role inherit from ... we're just bike-shedding over how far up the tree to put the common behavior. -Chris