Can I create a package with friendly modules

forkit forkit at gmail.com
Sun Jun 12 23:29:29 UTC 2022


On Sunday, 12 June 2022 at 05:46:17 UTC, Mike Parker wrote:
>

I don't get it.

How does this enable one module to access the private parts of 
another module?

Isn't 'private' *always* private to the module?

The idea I had, was to be able to spread a 'module' over more 
than one file - for the purpose of encapsulating this and that in 
different physical files, while *still* protecting the 'private 
is private to the module' concept.

e.g.

// main module
module myMainModule [extends: mod1, mod2, mod3];

when I compile this module myMainModule, the compiler brings the 
extensions of this module, and treats it as a single module.

similar to the concept of bringing in different modules into a 
package, only more fine-grained.

But if D has a one-to-one mapping between a module and a file, 
and if private is always private to the one module, then this 
could never work.



More information about the Digitalmars-d-learn mailing list