Andrei's interface requests

Kagamin spam at here.lot
Sun Apr 5 03:19:58 PDT 2009


Andrei Alexandrescu Wrote:

> interface Interface { void foo(); }
> void foo(T : Interface)() { ... }
> class C { void foo(); }
> 
> C does not explicitly declare abiding to Interface. However, 
> structurally it does. Should foo be called? If interface is meant for 
> binary binding, no. If interface is meant for concept checking, maybe.

Interface[] rg;
interface Interface { void foo(); }
void foo(T : Interface)(T i) { rg~=i; }
class C { void foo(); }

What should happen here? Template will accept C and give error?



More information about the Digitalmars-d mailing list