[Issue 10378] Prevent local imports from hiding local symbols

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Feb 18 11:49:33 PST 2016


https://issues.dlang.org/show_bug.cgi?id=10378

--- Comment #35 from timon.gehr at gmx.ch ---
(In reply to Steven Schveighoffer from comment #34)
> What I mean is, really Timon's code should be:
> 
> string readAndLog(string filename){
>     import std.file : readText;
>     auto text=readText(filename);
>     write(filename," read successfully!\n");
>     return text;
> }
> 
> i.e. only use scoped imports with a qualified list of which symbols you will
> use, or use a renamed import.
> 
> This prevents any hijacking.

Well, there's an arbitrary number of conventions that will prevent any
hijacking.
The point of my example was to expose a remaining flaw in the new import lookup
design.

--


More information about the Digitalmars-d-bugs mailing list