On Thursday, 30 January 2014 at 16:53:33 UTC, Namespace wrote:
On Thursday, 30 January 2014 at 16:47:46 UTC, Frustrated wrote:
On Thursday, 30 January 2014 at 16:28:42 UTC, Namespace wrote:
On Thursday, 30 January 2014 at 16:24:00 UTC, Stanislav Blinov wrote:
void main() {
        F f;
        int i = f(3,4,5);
        float f_ = f!float(6, 7, 8);
}
----

Does not work, it fails with:
Error: template instance f!float f is not a template declaration, it is a variable

f.opCall!float(6, 7, 8);

... Yes, of course. But where is the sense to use opCall if I need to call it explicitly?

Could you not use opDispatch? Not sure if you can templatize it
or not though...

Example? I did not know how.


doesn't seem to work with templates, I suppose you could try and
add it as a feature request?

module main;

import std.stdio;

interface A
{
        void foo();
        static final New() { }
}

class B : A
{
        void foo() { writeln("this is B.foo"); }

        void opDispatch(string s, T)(int i) {
                writefln("C.opDispatch('%s', %s)", s, i);
        }

}


void main() {
        B a = new B;
        //a.foo();

        a.test!int(3); // any *good* reason why this shouldn't work?

}

Reply via email to