www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - I don't think that package works

reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
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()? 
Mar 22 2006
parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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 -----BEGIN PGP SIGNATURE----- iD8DBQFEJAPa3w+/yD4P9tIRAq5QAKCkQ+DITKSfEOL4PJBu+0Nw+WaukgCfceY/ NZVspTtu633FQx1kSc11ICk= =Jauj -----END PGP SIGNATURE-----
Mar 24 2006