On Tue, 2004-03-16 at 10:25, Dan Sugalski wrote:

> Unless I missed something, child classes inherit parent class roles, 
> so if I have Foo with a role of X, and Bar inherits from Foo, Bar 
> does the X role. Looks like inheritance to me...

That's normal inheritance and that's fine.

Consider instead a class that does a role but does not inherit anything.

Roles should not affect method dispatch.  Inheritance should.

Compilation
-----------

- Roles         - apply methods from a role
                - mark that the applying class does the role

- Inheritance   - mark that the inheriting class inherits


Method dispatch
---------------

- Roles         - do not look at any applied roles for methods
                not present in the invocant's class

- Inheritance   - look in the parent classes for methods not present
                in the invocant's class


Type checking
-------------

- Roles         - look at the applied roles for a match

- Inheritance   - look at the parent classes for a match


That all leads me to believe there are two separate questions:

1) What is the type of this object (what kind of behavior can I expect
from it)?

2) Where does it get its methods?

I think mixing those two in one mechanism would be a mistake.

-- c

Reply via email to