Andrei Alexandrescu wrote:
What are your faves?
opDispatch was expectantly successful for me. I haven't seen it often used in examples or others peoples code, but it allows for some really awesome stuff. For instance, who says D doesn't have multiple inheritance? struct A { void a() { writeln("a"); } } struct B { void b() { writeln("b"); } } struct C { private A _a; private B _b; void opDispatch(string s)() { static if (__traits(hasMember, A, s)) mixin("_a."~s~"();"); else if (__traits(hasMember, B, s)) mixin("_b."~s~"();"); else static assert("Method not found."); } } void main() { auto c = C(); c.a(); c.b(); } and similarly, "alias x this" is useful for pseudo hierarchy. The only down-side to doing this is that Mono-D doesn't currently parse the syntax.