property magic for inerfaces (please!)

Reiner Pope reiner.pope at gmail.REMOVE.com
Sat Nov 18 20:49:32 PST 2006


== Quote from Daniel Keep (daniel.keep.lists at gmail.com)'s article
> There are two ways of doing this, depending on the situation.
> The first is to have an abstract base class, which allows you to add
> partial implementation.
> The other is to provide a mixin for the "default" implementation of
> certain methods.
The problem with both of these solutions is that they are conceptually wrong,
since they involve adding hasChildren to the vtbl, meaning it could have any
implementation. What Hasan was asking for was the ability for interfaces to
declare final methods in interfaces, which would mean they can't be overridden.

To achieve this the "proper" way you either need to support final methods in
interfaces or extension methods. Of course, the latter is already partly
implemented, and is a much more powerful feature, so I think it should be added to
D in any case.



More information about the Digitalmars-d mailing list