D import idiom compilation time

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Jan 5 01:54:44 UTC 2019


On 1/4/19 8:11 AM, bauss wrote:
> On Thursday, 3 January 2019 at 23:54:42 UTC, SrMordred wrote:
>> struct _std
>> {
>>   template opDispatch(string moduleName)
>>   {
>>     mixin("import opDispatch = std." ~ moduleName ~ ";");
>>   }
>> }
> 
> 
> There is nothing that's actually stopping you from just calling it std.
> 
> It will work just as fine.
> 
> That way you can end up with
> 
> std.stdio.writeln("...");
> 
> Instead of:
> _std.stdio.writeln("...");

This is quite amazing.


More information about the Digitalmars-d mailing list