digitalmars.D.bugs - [Issue 257] New: package vars accessible from sub-modules, package funcs not
- d-bugmail puremagic.com (48/48) Jul 18 2006 http://d.puremagic.com/issues/show_bug.cgi?id=257
- Thomas Kuehne (13/47) Sep 14 2006 -----BEGIN PGP SIGNED MESSAGE-----
- d-bugmail puremagic.com (10/10) Nov 26 2010 http://d.puremagic.com/issues/show_bug.cgi?id=257
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 digitalmars.com
ReportedBy: jarrett.billingsley 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.
--
Jul 18 2006
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 d-bugmail 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-----
Sep 14 2006
http://d.puremagic.com/issues/show_bug.cgi?id=257
Andrei Alexandrescu <andrei metalanguage.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |andrei metalanguage.com
AssignedTo|nobody puremagic.com |bugzilla digitalmars.com
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 26 2010









Thomas Kuehne <thomas-dloop kuehne.cn> 