On Wed, 21 Oct 2009, Ben Morrow wrote: > The most important detail here is that the *class* gets to pick which > imported methods need to be wrapped. [but] > What this doesn't fix is that some other code (outside the class) will be > expecting C::x to have T1::x semantics, and some will be expecting it to > have T2::x semantics. If these are contradictory, there is no way to write > an x which works. That's where the 'hats' idea comes in
Sounds like going back to static typing -- which does sometimes have some advantages. One way to implement at would be to use proxy objects, which only do one of the roles (by passing them through to the appropriate methods on the original object). This could be done transparently to formal parameters, so that when they're used locally they would dispatch the "expected" method based on the locally declared type for the object. -Martin