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.