www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - package attribute, more questions

Let's read this (and try to rewrite/fix it together):

<cite>"Package extends private so that package members can be accessed from
code in other modules that are in the same package. This applies to the
innermost package only, if a module is in nested packages."</cite>

http://www.digitalmars.com/d/attribute.html

1) "package members" (in first line) - who they are?
    variables, functions, classes - it is clear.

Question: members of classes -  variables, methods - are they
   package members?

2) I am totally crazy about "This applies to the innermost package only, if 
a module
    is in nested packages." Can we try to rewrite this in plain English?

Let's say we have three modules:

module pkg.module1;
module pkg.module2;
module pkg.subpkg.module3;

As for now:

module2 functions and members of module2 classes
can access
    packaged module1 functions
    packaged members of module1 classes.

module3 functions and members of module3 classes
can access
    packaged module1 functions
cannot access
    packaged members of module1 classes.

Is it desired behavior? I would expect that
module3 can access packaged members of module1 classes.

Because  module3 and module1 belong to the same package.
At least in Java this is true. (I know that D is not Java).

Gentlemen, we need to make this clear before 1.0
as this is so basic...

Andrew.
Apr 02 2005