Time to destroy Walter: breaking modules into packages

TommiT tommitissari at hotmail.com
Tue Jun 18 21:49:49 PDT 2013


On Thursday, 6 June 2013 at 06:09:41 UTC, Max Samukha wrote:
>
> 'package' should be fixed so that 'package' declarations are 
> accessible within nested packages.

I don't think the 'package' access specifier should give 
privileges to *all* nested packages. Rather, I think we just need 
to invent a new word, and then specifying what 'package' access 
specifier does becomes easy. My suggestion for this new word is 
"module-pack"...

Module-pack:
"A folder which has a file called package.d inside it. Can be 
imported as if it was a module. etc."

...then, the definition of 'package' access modifier would be:

"The label package can be specified at class level, outside all 
classes (module-level), or inside a struct. In all contexts, 
package introduces protection that allows access to the symbol to 
all modules and module-packs which are either within the same 
directory as the current module or within the same directory as 
the module-pack which holds the current module within. 
Non-module-pack subdirectories and the parent directory of the 
current module’s directory have no special privileges."

Basically we'd pretend that module-packs are like modules.


More information about the Digitalmars-d mailing list