Bug 143 – 'package' does not work at all

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2006-05-17T17:28:00Z
Last change time
2016-03-05T14:16:24Z
Keywords
accepts-invalid, bounty
Assigned to
code
Creator
jarrett.billingsley

Comments

Comment #0 by jarrett.billingsley — 2006-05-17T17:28:03Z
It doesn't work. I've tried so many things. It never prevents any kind of access. Assume the following directory structure: /proj/test.d /proj/modules/foo.d And the files: [test.d] module test; import modules.foo; void main() { writefln(x); } [foo.d] module modules.foo; package int x = 5; This happily compiles and runs, printing 5. I've tried multiple levels of directories/packages, different kinds of declarations, moving the import file somewhere else.. nothing.
Comment #1 by thomas-dloop — 2006-05-19T11:45:37Z
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [email protected] schrieb am 2006-05-17: > It doesn't work. I've tried so many things. It never prevents any kind of > access. The implementations of "private", "package" and "protected" are broken. Details can be found in the digitalmars.D.bugs group by searching for "private" or "package". Test cases: http://dstress.kuehne.cn/www/dstress.html#private_07 Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFEbc3k3w+/yD4P9tIRAq13AJ9+GSHvj8Kw4YpkSzBlPPYqXfO/TACfaYYf RLemX8Un1IofG+uW9OQ8ryQ= =jABO -----END PGP SIGNATURE-----
Comment #2 by michal.minich — 2010-12-09T04:45:31Z
test for package and private in DMD 2.050 shows that only functions and functions aliases works for both modifiers; and variables works for private only. [test.d] import pack.mod; void main () { i = 1; //pi = 1; // OK - Error: module main pack.mod.pi is private S s; C c = new C; U u; //fn (); // OK - Error: function mod.fn is not accessible from main //aFn (); // OK - Error: function mod.fn is not accessible from main aS as; } [pack/mod.d] module pack.mod; package : // private is ignored too int i; struct S {} class C {} union U {} alias S aS; // these works OK void fn () {} alias fn aFn; private int pi;
Comment #3 by github-bugzilla — 2012-02-18T11:04:47Z
Comment #4 by github-bugzilla — 2012-02-18T11:47:15Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/4d3529119ba17e90a0ef634cab145be3c76270fa Revert "fixed Issue 143" This reverts commit 1df95058f4c3c68d03ec69dd58491ff401a6434a.
Comment #5 by github-bugzilla — 2016-03-05T14:16:18Z