Proposal for an extension to the import syntax

Xinok xnknet at gmail.com
Mon Dec 11 21:22:20 PST 2006


import package.sub_package.vendor.[module_a.[sub1, sub2], module_b];
I think this can quickly become messy and difficult to read.

I have an idea, "virtual import". A virtual import doesn't actually import any
modules, it only imports a symbol:
virtual import package.sub_package.vendor;
import vendor.module_a.sub1;
import vendor.module_b.sub2;
import vendor.module_b;


The first problem though is this can easily cause naming collisions:
module std.stdio;
module std.c.stdio;

virtual import std, std.c;
import stdio; // Import std.stdio or std.c.stdio?


So perhaps defining an alias would work best:
virtual import mod : package.sub_package.vendor;
import mod.module_a.sub1, mod.module_a.sub2, mod.module_b;



More information about the Digitalmars-d mailing list