Maybe you could use just one name and put the dispatching code inside it? T actor(T)(T t) { switch (t.name) { case "Gramm.Expr": return foo(t); case "Gramm.FunctionCall": return foo(t); case "Gramm.Declaration": return foo(t); default: throw new Exception("..."); } }
or do it with a template, holding function names as aliases: alias actor = dispatcher!(foo, bar, baz);