Jonathan Lang wrote:
   role R3 does A & B { ... }
   R3.does(A) # false: R3 can't neccessarily do everything that A can.
   A.does(R3) # false: A can't neccessarily do everything that R3 can.

That last one should be true. Role R3 contains the things that A and B
have in common. Hence each of them has everything that R3 has.

And because you have the ability to add methods to R3 that aren't in A
or B, you can't make use of the fact that A & B is a subset of A for
type-checking purposes.

The really funny thing is what can be written into the body of role R3.
Should it be forbidden to introduce new methods? Or should new methods
automatically enter into A and B? The latter would be more useful but
then roles become somewhat open like classes because code that did not
typecheck before the superrole creation suddenly typechecks after it.
Or if the role R3 adds a yada method that propagates down the
composition chains, classes might retroactively fail to compile!

Regards, TSa.

Reply via email to