[Issue 10378] Prevent local imports from hiding local symbols

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Feb 17 11:53:01 PST 2016


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

--- Comment #30 from timon.gehr at gmx.ch ---
(In reply to hsteoh from comment #29)
> Do you have an example where this is problematic?
> 

Slightly contrived, but here you go:

import std.stdio;

string readAndLog(string filename){
    import std.file;
    auto text=readText(filename);
    write(filename," read successfully!\n");
    return text;
}

void main(){
    writeln(readAndLog("important_data.txt"));
}


> At any rate, it's better than the stonewall silence we've had on import
> issues for many years now.

I agree. This is way better than what we had before. If a fix for hijacking is
implemented, I would personally prefer to pick a proposed solution that
actually fixes the hijacking problems.

--


More information about the Digitalmars-d-bugs mailing list