Nick Sabalausky wrote:
If the member-name parameter to opDotExp was *required* to be a template
paramater, then I agree, and I would have no objections to having that.
But
it should be pointed out that that would not actually be dynamic
invokation,
since you wouldn't be able to invoke a member whose name is only known at
run-time. (But I would love for that to be possible through a reflection
API.)
As we can all clearly see, in obj.someDynamicFunction( "Foo!" );
"someDynamicFunction" is definately known at compile-time, and not something you could
change at runtime. Thus, making the member name parameter a template parameter seems the most
logical solution. The fact you can't invoke arbitrary members chosen at runtime with it has little
to do with opDotExp and much to do with how the D language is. If you want true dynamic invocation
you need a separate function anyway, or you'd end up with code like this:
string s = "someDynamicFunction";
obj.opDotExp( s );
Now, you could simply alias "opDotExp" to "invoke" or whatever you please, but
having invoke be a separate function does not seem like a horrible trade-off to me.
--
Simen