Objective-D, reflective programming, dynamic typing

Jarrett Billingsley jarrett.billingsley at gmail.com
Sun Apr 5 09:28:38 PDT 2009


On Sat, Apr 4, 2009 at 12:15 PM, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> Georg Wrede 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...)
>>> {
>>>   ...
>>> }
>>
>> Hmm. An idiom. My sweet tooth just got thirsty for syntactic sugar!
>
> When opImplicitCastFrom will be implemented, foo's definition will be
> enough. You'll write foo(1, 2.3, "a") and the compiler will rewrite it to
> foo(Variant(1), Variant(2.3), Variant("a")).
>
> Andrei

Oh wow, I missed this in the flood.  I'm very happy about this indeed!



More information about the Digitalmars-d mailing list