digitalmars.D.bugs - [Issue 10378] New: Local imports hide local symbols
- d-bugmail puremagic.com (31/31) Jun 16 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10378
- d-bugmail puremagic.com (12/12) Jun 16 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10378
- d-bugmail puremagic.com (21/21) Jun 16 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10378
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: nobody puremagic.com ReportedBy: peter.alexander.au gmail.com 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: -------
Jun 16 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10378 Martin Krejcirik <mk krej.cz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |mk krej.cz Resolution| |DUPLICATE *** This issue has been marked as a duplicate of issue 7329 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 16 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10378 Peter Alexander <peter.alexander.au gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|DUPLICATE | 11:44:54 PDT --- Example was invalid, here's a better one: string message = "Hello, world!"; void main() { import std.stdio; writeln(message); } Also, re-opening. This isn't a dupe. The other bug is just that the semantics are undocumented, not that the behaviour is incorrect. If the current behaviour is documented then the other bug may be closed, but this bug will still be present, so they are not the same bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 16 2013