LazyInterface (simplified Boost.Interfaces)

kenji hara k.hara.pg at gmail.com
Tue Sep 21 19:13:17 PDT 2010


There is no problem if it is only static opDispatch or non-static one.
But D does not allow to override theirs together.

We cannot compile this:
class A{
    int f(){return 10;}
    static int f(){return 20;}
}
void main(){
	auto a = new A();
	assert(a.f() == 10);
	assert(A.f() == 20);
}

Thanks.

bearophile wrote:
> But static opDispatch works:
>
> struct Foo {
>    static void opDispatch(string name, Args...)(Args args) {
>        static assert(name == "hello");
>    }
> }
> void main() {
>    Foo.hello(10, 20);
> }
>
>
> So if you have found a bug you may add a minimized case in Bugzilla.


More information about the Digitalmars-d mailing list