Hello Michel,

On 2009-04-18 17:48:33 -0400, Andrei Alexandrescu
<seewebsiteforem...@erdani.org> said:

Michel Fortin wrote:

On 2009-04-18 11:19:38 -0400, Andrei Alexandrescu
<seewebsiteforem...@erdani.org> said:

I'm confused. Isn't it clear that at the moment we "have" the
ability to pass a function name as a runtime string?

Indeed, you can pass the template argument as a runtime argument to
another function. No misunderstanding here.

What we're lacking is the ability to implement that using
reflection, but that's an entirely separated discussion!

Runtime reflection lacking indeed, but wether runtime reflection is
an entirely separated discussion depends on if what we're doing will
get in the way of implementing it.

And no, you're not supposed to forward from invoke(string,
Variant[]...) to opDotExp - it's precisely the other way around!

Wrong. Whether it's one way or another entirely depends on what your
goals are.

Wrong. It's impossible to pass a dynamic string as a static string,
so the street is one way.

Indeed it's impossible using a template which requires a static
string. And that's exactly the problem: some times you're supposed to
make it work both ways, as I've explained in the rest of my post
you've cut down. Did you read it?

I won't repeat everything, but here's the important part: not having
it go both ways *is* an important drawback. And it doesn't go both
ways only if opDotExp is a template.



If opDotExp is a template you can do:

struct S
{
    void NonStaticVersion(char[] name, args...) { ...}
    void opDotExp(char[] name, T...)(T t) { NonStaticVersion(name, t); }
}

if it is not a tamplate:

struct S
{
    void StaticVersion(char[] name, T ... )(T t) { ...}
    void opDotExp(char[] name, T...)
    {
       StaticVersion!(
                  /******** what goes here?? *********/
          )(T);
    }
}

you are either wrong, arguing something completely different than what everyone thinks you are or figured out how to do something everyone else thinks is impossible.


Reply via email to