http://d.puremagic.com/issues/show_bug.cgi?id=10378

           Summary: Local imports hide local symbols
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from Peter Alexander <[email protected]> 2013-06-16 
06:51:39 PDT ---
Imports local to a function are able to hide local symbols, which can lead to
subtle breakage when libraries change and unexpected behaviour:

void main()
{
    import std.stdio;
    string message = "Hello, world!";
    writeln(message);
}

Here, if a symbol "message" was added to std.stdio then the function would use
that message instead of the local message. This could cause subtle breakage
when users update to libraries that have added new symbols.

Local imports should behave the same as module-level imports, except the
symbols are only visible in the local scope. This prevents any sort of
unexpected behaviour without hindering the power of local imports. Ambiguous
names can always be disambiguated using full symbol qualification.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to