[Issue 257] New: package vars accessible from sub-modules, package funcs not
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jul 18 14:57:17 PDT 2006
http://d.puremagic.com/issues/show_bug.cgi?id=257
Summary: package vars accessible from sub-modules, package funcs
not
Product: D
Version: 0.163
Platform: PC
OS/Version: Windows
Status: NEW
Keywords: accepts-invalid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: jarrett.billingsley at gmail.com
-------- modules/mymod.d ----------
module modules.mymod;
package int foo;
package void bar()
{
}
-------- modules/level/test.d ----------
module modules.level.test;
import modules.mymod;
void f()
{
foo = 1;
bar();
}
----------------------------------------
Compiling those gives an error when trying to access bar() from test, but
accessing foo is OK.
Moreover,
-------- modules/mymod2.d ----------
module modules.mymod2; // notice it's in the same package as mymod
import modules.mymod;
void f()
{
foo = 1;
bar();
}
--------------------------------------
Works, as expected, just fine.
If I'm reading the spec correctly, neither foo or bar() should be accessible
from test, as only modules in the same package (i.e. other modules in the
"modules" package; test is in "modules.level") should be able to access them.
I'm flagging this as accepts-invalid, as you can access foo, when I don't think
you should.
--
More information about the Digitalmars-d-bugs
mailing list