Can I create a package with friendly modules
Mike Parker
aldacron at gmail.com
Mon Jun 13 01:04:17 UTC 2022
On Sunday, 12 June 2022 at 23:29:29 UTC, forkit wrote:
>
> I don't get it.
>
> How does this enable one module to access the private parts of
> another module?
It doesn't. But what you were describing in your post is
package-level access. By keeping it the cross-module access in a
subpackage, package is "private" to that subpackage.
>
> Isn't 'private' *always* private to the module?
Yes, which is why it doesn't allow cross-module access.
>
> 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.
You can't spread modules across multiple files.
>
> 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.
Not with private. But what I described is the same effect.
More information about the Digitalmars-d-learn
mailing list