March 23, 2006 I don't think that package works | ||||
---|---|---|---|---|
| ||||
Please tell me what I'm doing wrong here. ----------------- /dtest/dtest.d ----------------- module dtest; import modules.mymod; void main() { f(); g(); h(); } ----------------- /dtest/modules/mymod.d ----------------- module modules.mymod; public void f() { } private void g() { } package void h() { } DMD correctly flags my trying to call g() as an error. But it doesn't flag h(). Shouldn't only other files in /dtest/modules/ be able to access h()? |
March 24, 2006 Re: I don't think that package works | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley Attachments: | Jarrett Billingsley schrieb am 2006-03-23: > Please tell me what I'm doing wrong here. > > ----------------- > /dtest/dtest.d > ----------------- > > module dtest; > > import modules.mymod; > > void main() > { > f(); > g(); > h(); > } > > ----------------- > /dtest/modules/mymod.d > ----------------- > > module modules.mymod; > > public void f() > { > > } > > private void g() > { > > } > > package void h() > { > > } > > > DMD correctly flags my trying to call g() as an error. But it doesn't flag h(). Shouldn't only other files in /dtest/modules/ be able to access h()? Your interpretation is correct. http://dstress.kuehne.cn/nocompile/package_01.d (and http://dstress.kuehne.cn/addon/package_01_A.d) Thomas |
Copyright © 1999-2021 by the D Language Foundation