"Andrei Alexandrescu" <seewebsiteforem...@erdani.org> wrote in message news:gsav4n$2ij...@digitalmars.com... > > It's a good question. opDotExp leaves more flexibility because it allows > for a host of compile-time manipulations, e.g. decide to forward to a > member etc. Also consider this (probably Nick will turn blue): > > struct Pascalize(T) > { > T m; > auto opDotExp(string name, T...)(T args) > { > return mixin("m."~tolower(name))(args); > } > } > > struct S { void foo() { ... } } > > Pascalize!S s; > s.foo(); // works > s.Foo(); // works too > s.fOo(); // yup, works again >
It's really late, so I can't come up with much coherent thought, but: 1. Ick. 2. Wasn't the potential for just that sort of abuse a big part of the reason for ditching #define? 3. struct F { void fooBar() { ... } } Pascalize!F f; // Can't invoke shit! // Don't ask me what point I'm trying to make with that, // I don't even know, myself.