interface + mixin combination
Bill Baxter
dnewsgroup at billbaxter.com
Mon Oct 30 16:43:21 PST 2006
Daniel Keep wrote:
> How about doing it around the other way?
>
>> template SlotTracking
>> {
>> implements ISlotTracking;
>> // implementation...
>> }
>>
>> class Reciever
>> {
>> void handleClick() { writefln("in ad2101 button clicked!"); }
>> mixin SlotTracking;
>> }
>
> After all, you might want to implement the interface without pulling in
> the mixin, but using the mixin doesn't make much sense *without*
> implementing the interface.
>
> Another syntax idea while I'm at it:
>
>> template SlotTracking : ISlotTracking
>> {
>> // implementation...
>> }
>
> -- Daniel
>
Hmm. I like seeing the clear indicator in the class implementing the
interface that it can be treated as something other than just it's base
class type. So maybe there could be a special 'mixin' inheritance.
class Receiver : mixin ISlotTracking
// interface *and* mixin implementation taken
{
...
}
vs
class Receiver : ISlotTracking
// just the interface part taken, I'll handle the implementation myself
{
...
}
--bb
More information about the Digitalmars-d
mailing list