UCFS, Reflection/Metadata, Overload Resolution, Templates, and other issues

Steven Schveighoffer schveiguy at yahoo.com
Thu Apr 7 11:30:34 PDT 2011


On Thu, 07 Apr 2011 14:20:53 -0400, %u <wfunction at 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


More information about the Digitalmars-d mailing list