Max Samukha Wrote: > On Sun, 04 Oct 2009 00:10:30 +0200, Yigal Chripun <yigal...@gmail.com> > wrote: > > > > >class FlippingBlipper : IBlipper, IFilpper > >{ > > mixin Flipper F; > > mixin Blipper B; > > alias F.nameCollision nameCollision; > >} > > > > The problem is that IBlipper.nameCollision is totally unrelated > to IFlipper.nameCollision (for example, if the interfaces/mixins come > from third-party libraries, whose developers don't know or care > about each other, e.g. Tango/Phobos :P). That's why either > nameCollision must have its own implementation. > > In current D: > > auto fb = new FlippingBlipper; > IFlipper f = fb; > IBlipper b = fb; > f.nameCollision; > b.nameCollision; > > Both calls are dispatched to the same implementation (the one provided > by Flipper template), which is incorrect and undesirable. > > >I wonder if the following would work: > > > >class FlippingBlipper : IBlipper, IFilpper > >{ > > mixin Flipper IFilpper; > > mixin Blipper IBlipper; > >} > > > > > > I don't think so.
I see. What you want is non-virtual MI. I don't think that allowing the derived class to have two distinct implementations for the same function prototype is a good idea. Eiffel handles this by giving the programmer controls to select features and rename them in the derived class which I think is better. // hypothetical syntax example class FlippingBlipper : IBlipper, IFilpper { mixin Flipper F; mixin Blipper B; // rename the inherited interface functions alias IBlipper.nameCollision boo; alias IFilpper.nameCollision foo; // implement the now two distinct functions void foo() { F.nameCollision(); } void boo() { B.nameCollision(); } } you can further subtype and the derived foo & boo will override the respective interfaces.