digitalmars.D.learn - Package explain
- Zarathustra (19/19) Aug 21 2008 Could anybody explain what "package" exctly mean?
- Jesse Phillips (3/29) Aug 21 2008 I don't see anything in the docs about a package import. Public, Private...
- Ary Borenszweig (4/35) Aug 21 2008 Here goes my opinion about this again: any modifier that doesn't make
- Jarrett Billingsley (5/24) Aug 21 2008 "static" does not make variables private as in C. "private" does that.
- Fawzi Mohamed (15/48) Aug 21 2008 yes static int variable = 3; actually means
- bearophile (4/7) Aug 21 2008 I agree in general, but recently someone in the main D newsgroup has exp...
Could anybody explain what "package" exctly mean? module package1.module1; static int variable = 3; module package1.module2; module package1.module3; package import package1.module1, package1.module2; module main; import package1.module3; void main(){ variable1 = 5; // Why variable is accessable? } | |--- main |--- package1 | |--- module1 |--- module2 |--- module3 I'm dsss user.
Aug 21 2008
On Thu, 21 Aug 2008 05:45:16 -0400, Zarathustra wrote:Could anybody explain what "package" exctly mean? module package1.module1; static int variable = 3; module package1.module2; module package1.module3; package import package1.module1, package1.module2; module main; import package1.module3; void main(){ variable1 = 5; // Why variable is accessable? } | |--- main |--- package1 | |--- module1 |--- module2 |--- module3 I'm dsss user.I don't see anything in the docs about a package import. Public, Private, Static, but not Package.
Aug 21 2008
Jesse Phillips a écrit :On Thu, 21 Aug 2008 05:45:16 -0400, Zarathustra wrote:Here goes my opinion about this again: any modifier that doesn't make sense in a given context, should be a compiler error. This thread is and example of what happens if this is not the case.Could anybody explain what "package" exctly mean? module package1.module1; static int variable = 3; module package1.module2; module package1.module3; package import package1.module1, package1.module2; module main; import package1.module3; void main(){ variable1 = 5; // Why variable is accessable? } | |--- main |--- package1 | |--- module1 |--- module2 |--- module3 I'm dsss user.I don't see anything in the docs about a package import. Public, Private, Static, but not Package.
Aug 21 2008
"Zarathustra" <adam.chrapkowski gmail.com> wrote in message news:g8jdfc$cqk$1 digitalmars.com...Could anybody explain what "package" exctly mean? module package1.module1; static int variable = 3;"static" does not make variables private as in C. "private" does that. Declarations are implicitly public, hence why you can access it in main.module package1.module2; module package1.module3; package import package1.module1, package1.module2;Yeah, what the hell is "package import"?module main; import package1.module3; void main(){ variable1 = 5; // Why variable is accessable? } | |--- main |--- package1 | |--- module1 |--- module2 |--- module3 I'm dsss user.
Aug 21 2008
On 2008-08-21 16:51:26 +0200, "Jarrett Billingsley" <kb3ctd2 yahoo.com> said:"Zarathustra" <adam.chrapkowski gmail.com> wrote in message news:g8jdfc$cqk$1 digitalmars.com...yes static int variable = 3; actually means public static int variable =3; if you write private static int variable =3; you can't access it from any other module if you write package static int variable =3; you can access it from module2 and module3 (that are in the same package) but not from main.Could anybody explain what "package" exctly mean? module package1.module1; static int variable = 3;"static" does not make variables private as in C. "private" does that. Declarations are implicitly public, hence why you can access it in main.this is most likely not implemented, it is documented nowhere, you might expect it for symmetry reasons, but it is not there. If you think it should be there (and really I cannot think a good case in which you need it) try filing a bug report... Fawzimodule package1.module2; module package1.module3; package import package1.module1, package1.module2;Yeah, what the hell is "package import"?module main; import package1.module3; void main(){ variable1 = 5; // Why variable is accessable? } | |--- main |--- package1 | |--- module1 |--- module2 |--- module3 I'm dsss user.
Aug 21 2008
Ary Borenszweig:Here goes my opinion about this again: any modifier that doesn't make sense in a given context, should be a compiler error. This thread is and example of what happens if this is not the case.I agree in general, but recently someone in the main D newsgroup has explained me why the 'scope' attribute can't work in the way you like, so some leeway may be inevitable (but I presume less than the current one). Bye, bearophile
Aug 21 2008