import std.stdio; class Foo { void xyz() { writeln("Xyz without arguments exists!"); } void opDispatch(string name, T...)(T args) in { static assert (name == "foo" || name == "baz", "Invalid method called!"); } body { writeln("Called method: ", name); foreach (i, arg; args) writefln("args[%d] == %s", i, arg); } } void main() { Foo bar = new Foo(); bar.baz(); bar.xyz(); bar.foo("hello", [5,10,15], 3.14f, ["foo":5, "bar":10], true); bar.asdasdasd(); }