Thread overview | ||||||
---|---|---|---|---|---|---|
|
September 24, 2012 [Issue 8716] New: `package` restricts members usage in same module if there is no package name | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=8716 Summary: `package` restricts members usage in same module if there is no package name Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: verylonglogin.reg@gmail.com --- Comment #0 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2012-09-24 09:17:45 MSD --- All asserts passes for e.g. `a.b` module name (except `C.init.sf()` which isn't evaluatable at CT now). --- module ab; package int gf() { return 0; } static assert(gf() == 0); // function ab.gf is not accessible from module ab class C // struct, class, or union { package: enum e = 0; immutable static int si = 0; static int sf() { return 0; } immutable int i = 0; int f() const { return 0; } } static assert(C.e == 0); static assert(C.si == 0); static assert(C.sf() == 0); // function ab.C.sf is not accessible from module ab static assert(C.i == 0); static assert(C.init.e == 0); static assert(C.init.si == 0); // undefined identifier 'si' static assert(C.init.sf() == 0); // struct main.T!().C member sf is not accessible static assert(C.init.i == 0); --- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 24, 2012 [Issue 8716] `package` restricts members usage in same module if there is no package name | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis Shelomovskij | http://d.puremagic.com/issues/show_bug.cgi?id=8716 Jonathan M Davis <jmdavisProg@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg@gmx.com --- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-09-23 22:57:26 PDT --- I'm not sure that this is a bug, though the behavior is obviously surpising. Technically speaking, your module isn't _in_ a package, so naturally it won't have access to anything with package level access. For a module to be in a package, it needs to be explicitly put in one. e.g. module x.y; Without that first x., it's a module without a package, because there is no top-level package which holds modules which aren't explicitly put in a package. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 24, 2012 [Issue 8716] `package` restricts members usage in same module if there is no package name | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis Shelomovskij | http://d.puremagic.com/issues/show_bug.cgi?id=8716 --- Comment #2 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2012-09-24 10:08:05 MSD --- Of course, but it's common in D that there is no access restrictions in the same module at all. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 26, 2013 [Issue 8716] `package` restricts members usage in same module if there is no package name | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis Shelomovskij | http://d.puremagic.com/issues/show_bug.cgi?id=8716 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull CC| |andrej.mitrovich@gmail.com AssignedTo|nobody@puremagic.com |andrej.mitrovich@gmail.com --- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-26 13:43:03 PST --- https://github.com/D-Programming-Language/dmd/pull/1556 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation