Hi,

I'm trying to learn how opDispatch works. Unfortunately, a very simple example already doesn't work (error: no property 'a' for type 'Foo'):

import std.stdio : writeln;

struct X {
        int a;
}
class Foo {
        X value;
        template opDispatch(string s) {
                value.opDispatch!(s) opDispatch;
        }
}
int main() {
        auto f = new Foo;
        writeln(f.a);
        return 0;
}

What am I missing?

Is there another way to make Foo forward all unknown things to X ?

Reply via email to