On Thu, 07 Apr 2011 14:20:53 -0400, %u <wfunct...@hotmail.com> wrote:

I was trying to write a "Dynamic" class for D, which uses opDispatch
to allow for late binding, but I ran into a problem:

While my class works well for regular methods inside a class, it
fails to work for:
(1) Template methods inside a class
(2) Methods with overloads
(3) Global methods that have nothing to do with a class, like
writeln
Furthermore, it would also fail to work for (4) UCFS if/when it's
implemented.

It seems like templates by design *don't* allow for anything to
happen dynamically, and at the same time, it seems like _everything_
is becoming a template nowadays.

So my question is, is there anything we can do about it (either now
or later)? Or is a dynamic extension simply beyond the reach of D?

I tried a "wrapper" type using opDispatch in dcollections, but what I ran into is, opDispatch uses its called parameter types to decide the function parameter types, you have very little control over that. I basically ended up abandoning the use of opDispatch and implemented each covered function by hand.

I filed an enhancement request for it, which probably doesn't cover everything you listed, but it might help:

http://d.puremagic.com/issues/show_bug.cgi?id=4998

-Steve

Reply via email to