Name That Technique!

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 3 15:33:58 PST 2017


On 2/3/2017 11:14 AM, Andrei Alexandrescu wrote:
> On 2/3/17 10:41 AM, Daniel N wrote:
>> On Friday, 3 February 2017 at 14:43:01 UTC, Dominikus Dittes Scherkl wrote:
>>> DIP 1005 provides new syntax to make it possible to avoid global imports.
>>> Any thoughts?
>>
>> I like it!
>>
>> template imp(string mod)
>> {
>>   mixin("import imp = " ~ mod ~ ";");
>> }
>>
>> auto fun_time(imp!"std.datetime".SysTime tm)
>> {
>>   return tm;
>> }
>>
>> void main()
>> {
>>   import std.stdio;
>>   import std.datetime;
>>
>>   fun_time(Clock.currTime()).writeln;
>> }
>
> 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!

I agree, it's pretty dazz! We need to give this technique a memorable name (not 
an acronym). I thought "Voldemort Types" turned out rather well, whereas CTFE is 
klunky, UFCS is even worse. The absolute worst is C++ SFINAE.

Any ideas?

   Scherkl-Nielsen Lookup?

The perfect bikeshedding moment!

Daniel, Dominikus: please consider writing an article about this.



More information about the Digitalmars-d mailing list