Overload on opDispatch ?
Jacob Carlborg
doob at me.com
Sat Dec 5 02:51:01 PST 2009
Would it be a good idea to allow overloading on opDispatch to make the
following compile, what do you think?
import std.stdio;
class C
{
void opDispatch(string s, ARGS...) (ARGS args)
{
writefln("S.opDispatch('%s', %s)", s, typeof(args).stringof);
}
void foo (string s)
{
writeln("in asd");
}
}
void main()
{
C c = new C;
c.foo("bar"); // calls C.foo
c.foo("bar", "bar"); // calls C.opDispatch
c.foo(3); // calls C.opDispatch
}
More information about the Digitalmars-d
mailing list