digitalmars.D.bugs - [Issue 8564] New: Ambiguous renamed import is allowed
- d-bugmail puremagic.com (42/42) Aug 20 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8564
- d-bugmail puremagic.com (13/13) Aug 20 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8564
http://d.puremagic.com/issues/show_bug.cgi?id=8564 Summary: Ambiguous renamed import is allowed Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: maxim maxim-fomin.ru --- Currently dmd accepts renamed import with local name, which hijacks current module name and creates ambiguity. in foo2.d: module foo2; import std.stdio; void bar() { writeln("foo2"); } in foo1.d: module foo1; import std.stdio; void bar() { writeln("foo1"); } int x; void main() { } x is defined in foo1.d -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 20 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8564 --- Forgot to mention, "foo1.bar();" actually calls foo2.bar() which I consider the biggest problem in this situation. It is unlikely, that import hijack could be written in purpose, but: 1) such situation can occur unintentionally, when programmer renamed/moved file and forgot to update import line 2) foo1.bar() is actually foo2.bar() and this is very bad because it contradicts to D approach "issue error if ambiguous function call is found". -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 20 2012