On Thu, Jul 23, 2009 at 01:21:18PM +0900, Goro Fuji wrote:
> I wonder why Role inherits methods from Class.
Do you mean "doesn't inherit"? Right now they're basically duplicated.
> 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.
Ugh. I'd rather have something like the immutable trait than fiddle with isa.
Or use inheritance in a more straightforward way, with a single package they
both inherit from (which is where this discussion started, after all).
hdp.