[Issue 257] New: package vars accessible from sub-modules, package funcs not
Thomas Kuehne
thomas-dloop at kuehne.cn
Thu Sep 14 05:13:27 PDT 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
d-bugmail at puremagic.com schrieb am 2006-07-18:
> http://d.puremagic.com/issues/show_bug.cgi?id=257
> -------- 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.
Added to DStress as
http://dstress.kuehne.cn/nocompile/p/package_05_A.d
http://dstress.kuehne.cn/nocompile/p/package_05_B.d
( http://dstress.kuehne.cn/addon/package_05_Z.d )
Thomas
-----BEGIN PGP SIGNATURE-----
iD8DBQFFCUaaLK5blCcjpWoRAjbbAKCSllSXmw7QFo2V3srH49gDTGtKswCfXdiN
BY+/ItsnTXzLkDtlG+WubnE=
=SNmH
-----END PGP SIGNATURE-----
More information about the Digitalmars-d-bugs
mailing list