Goro,
But the problem is that Class also has the notion of inheritance,
which Roles do not.
This is the closest I have come to a Class/Role model, but i never
figured out how to implement it cleanly.
http://img.skitch.com/20090723-qjrrm9m52uj5919nn67wj7ddrr.jpg
Class is an instance of Class (we already have this)
Role is an instance of Class
Role does Role
Class does Role
- Stevan
On Jul 23, 2009, at 12:21 AM, Goro Fuji 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)