On Mon, 20 Apr 2009 06:09:28 +0400, Steven Schveighoffer <schvei...@yahoo.com>
wrote:
Yes, there are many things that opDotExp can do that opDot or alias this
(which is essentially opDot without any code). Hooking every function
call on a type seems to be one of the two killer use cases of this
feature (the other being defining a large range of functions from which
only a small number need to exist). But call forwarding seems not to be
one of them. There are better ways to simply forward a call (such as in
your variant example).
I'm pretty convinced that this is a useful feature, I still have qualms
about how it's really easy to define a runtime black hole where the
compiler happily compiles empty functions that do nothing instead of
complaining about calling a function that does not exist.
Also, I don't think the requirement for this feature needs to be for the
arguments to be templated, it should be sufficient to have a single
string template argument. This way, you can overload opDotExp functions
via argument lists.
That way you loose type safety of arguments.
And BTW, the answer to your question above I think:
mixin("return inner."~name~"(args)");
Andrei demonstrated this usage in his Pascalize example.
-Steve
Oh, right, I saw his post but forgot that solution. Thanks you!