static vs. dynamic interfaces

Trass3r un at known.com
Wed Dec 28 17:59:22 PST 2011


phobos currently checks "static interfaces" with something like 
https://github.com/D-Programming-Language/phobos/blob/master/std/range.d#L213

I wonder if stuff like that could be unified by only defining 
normal interfaces and "automating" the static checking with 
something like

template implements(T, I) if (is(I == interface))
{
    enum implements = is(typeof({foreach(t;__traits(allMembers,I)) 
// check T}));
}

Possible? Reasonable?


More information about the Digitalmars-d mailing list