equivariant functions
Christopher Wright
dhasenan at gmail.com
Mon Oct 13 18:44:15 PDT 2008
Jason House wrote:
> Templates are non-virtual right now
That could be changed, but it would require a lot of bookkeeping in
temporary files (and not object files). And it would interfere with
precompiled libraries.
Once D gets decent runtime reflection, I'd like to get generics that
would pretty much just hide a bunch of casts and reflection calls:
generic (T : class) void foo (T thing)
{
int i = thing.someMethod();
thing.otherMethod (10, true, new Object());
}
transforms to:
void foo (ClassInfo info, Object thing)
{
int i = *cast(int*)info.getMethod ("someMethod").invoke!()(thing);
info.getMethod ("otherMethod").invoke!(uint, bool, Object)(thing, 10,
true, new Object());
}
But that's probably a bit much to ask.
More information about the Digitalmars-d
mailing list