Objective-D, reflective programming, dynamic typing
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sat Apr 4 09:21:10 PDT 2009
Christopher Wright wrote:
> Andrei Alexandrescu wrote:
>> void foo_templated(T...)(T args)
>> {
>> Variant[args.length] dynatyped;
>> foreach (i, arg; args) dynatyped[i] = arg;
>> return foo(dynatyped);
>> }
>> void foo(Variant[] dynatyped...)
>> {
>> ...
>> }
>>
>> Andrei
>
> Okay, that's a reasonable solution, except that it doesn't work with
> interfaces. I already submitted a bugzilla entry that you should be able
> to create a Variant[] from D varargs, but that still requires writing a
> wrapper function.
A Variant[] is difficult to create from TypeInfo[] + void* varargs
because vital information has already been lost. That's why I'm saying
we better fix the situation by e.g. implementing opImplicitCast. Please,
let's leave void* alone.
Andrei
More information about the Digitalmars-d
mailing list