April 05, 2009 Re: Andrei's interface requests | ||||
---|---|---|---|---|
| ||||
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?
|
Copyright © 1999-2021 by the D Language Foundation