Bug 1238 – Private identifiers in imported modules create conflicts with public ones

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2007-05-17T09:00:00Z
Last change time
2016-03-05T14:16:24Z
Keywords
rejects-valid
Assigned to
nobody
Creator
ryg

Comments

Comment #0 by ryg — 2007-05-17T09:00:42Z
Repro: // ---- start import std.stdio; import std.stream; import std.ctype; void main() { writefln("%d", isdigit('1')); } // ---- end The problem seems to be the couple of "helper functions" at the end of stream.d. Easiest workaround would probably simply declaring them static as well as private (and the same probably applies to other module-scope private variables/functions in Phobos). Anyway, since the spec states that "Private module members are equivalent to static declarations in C programs" (in "Attributes"), declaring anything "private" at module scope should probably force static linkage.
Comment #1 by smjg — 2007-06-26T05:52:07Z
A self-contained testcase: ---------- module ppc_1a; import ppc_1b; import ppc_1c; int qwert = yuiop; ---------- module ppc_1b; private int yuiop; ---------- module ppc_1c; public int yuiop; ---------- ppc_1a.d(5): Error: ppc_1b.yuiop at ppc_1b.d(3) conflicts with ppc_1c.yuiop at ppc_1c.d(3) ppc_1a.d: module ppc_1a ppc_1b.yuiop is private ----------
Comment #2 by dsimcha — 2008-08-06T12:15:18Z
*** Bug 1754 has been marked as a duplicate of this bug. ***
Comment #3 by github-bugzilla — 2012-02-18T16:18:22Z
Comment #4 by github-bugzilla — 2012-02-18T16:22:53Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/e6c8554df338a13202d4140ea7a6b1b37853f5c1 Revert "fixed Issue 1238" This reverts commit 1218502560ca19d7cf95bf277525b17c3b7186eb.
Comment #5 by destructionator — 2013-08-18T07:16:25Z
This is still a problem with D2... adding a private function shouldn't break the build of user modules. There's no ambiguity because obviously the private one is never wanted as it is inaccessible anyway.
Comment #6 by dlang-bugzilla — 2013-09-05T16:12:42Z
*** Issue 10411 has been marked as a duplicate of this issue. ***
Comment #7 by hsteoh — 2014-07-15T02:31:21Z
*** Issue 13096 has been marked as a duplicate of this issue. ***
Comment #8 by schuetzm — 2015-03-17T16:14:53Z
*** Issue 14301 has been marked as a duplicate of this issue. ***
Comment #9 by timothee.cour2 — 2015-05-30T19:28:46Z
Faced this again, this is a serious bug that's 8 years old !! What are the difficulties involved in fixing this? For example, I see workarounds such as https://issues.dlang.org/show_bug.cgi?id=14301 which don't really address the root cause. Anything wrong with http://wiki.dlang.org/DIP22?
Comment #10 by ketmar — 2015-05-30T20:17:50Z
(In reply to Timothee Cour from comment #9) > Faced this again, this is a serious bug that's 8 years old !! > > What are the difficulties involved in fixing this? exactly zero difficulties. Kenji's PR3416 works like a charm, i'm using it since a long time ago, and has ZERO problems with it. except some missing imports in some projects, which i reported and authors happily fixed — and that couldn't be found without the patch, accumulating bugs and "we can't merge the patch as it will break user code" murmur. i'm almost sure now that modules are broken by intention, as having a solution for such a long time and happily ignoring it (and me writing about it) looks like a plan, not like an oversight. so calm down and get used to it, it will never be fixed.
Comment #11 by github-bugzilla — 2015-06-27T14:08:45Z
Comment #12 by github-bugzilla — 2015-10-04T18:19:35Z
Comment #13 by github-bugzilla — 2016-03-05T14:16:19Z