On 05/21/2010 01:34 PM, Walter Bright wrote:
Andrei Alexandrescu wrote:
I wrote a solution to the problem in native D. It goes like this:

alias Container!(int, addable | purgeable) Messerschmidt;

void messWith(Messerschmidt i) {
... use i's capabilities to add and purge ...
}

I agree with Michael Fortin that the | is questionable. I'd like to
suggest instead that it should instead be a variadic list of names, like:

alias Container!(int, addable, purgeable) Msserschmidt;

Perhaps the names should follow a naming convention,


alias Container!(int, ContainerAddable, ContainerPurgeable) Msserschmidt;

The problem with using scoped names, like Container.Addable, is scoped
names cannot be added to.

Well the problem stays: compound interfaces grow combinatorially with the number of components, because an interface X!(A, B, C) inherits at the same time X!(A, B), X!(A, C), and X!(B, C).

Check the epic inheritance diagram here:

http://www.artima.com/cppsource/codefeatures2.html

and the equally epic table here:

http://www.artima.com/cppsource/codefeatures3.html


Andrei

Reply via email to