Workaround for DIP 1005

Daniel Nielsen via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 3 13:23:22 PST 2017


On Friday, 3 February 2017 at 20:04:22 UTC, Daniel Nielsen wrote:
> On Friday, 3 February 2017 at 19:14:16 UTC, Andrei Alexandrescu 
> wrote:
>>
>> Wow. This is... brilliant. Thanks for the great idea. I ran a 
>> few tests and it seems to be doing out of the box most of what 
>> we want with DIP1005 with no language change at all.
>>
>> Congratulations!
>>
>>
>> Andrei
>

I just had to try one more thing. It never ceases to amaze me 
what is possible in D today.

template imp(string mod) { mixin("import imp = " ~ mod ~ ";"); }
auto fun_time(imp!"std.datetime".SysTime tm) { return tm; }

void main()
{
   with(imp!"std.datetime")
     static if(is(Clock))
       with(imp!"std.stdio")
         Clock.currTime.fun_time.writeln;
}



More information about the Digitalmars-d mailing list