Re: Can I create a package with friendly modules

2022-06-16 Thread Salih Dincer via Digitalmars-d-learn
On Monday, 13 June 2022 at 06:05:03 UTC, Tejas wrote: Directory structure: ```sh src | |--- main_file.d | |---parent | |--- driver.d | |--- package.d | |--- thing | |--- package.d | |--- first.d

Re: Can I create a package with friendly modules

2022-06-13 Thread Tejas via Digitalmars-d-learn
On Sunday, 12 June 2022 at 05:05:46 UTC, forkit wrote: Is it possible to create a package.d, consisting of (for example), two modules, where each module can access private declarations within each other. In essence, declaring 'a module level friendship', or a kind of 'extended module' if you

Re: Can I create a package with friendly modules

2022-06-12 Thread Mike Parker via Digitalmars-d-learn
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,

Re: Can I create a package with friendly modules

2022-06-12 Thread forkit via Digitalmars-d-learn
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

Re: Can I create a package with friendly modules

2022-06-12 Thread Salih Dincer via Digitalmars-d-learn
On Sunday, 12 June 2022 at 05:05:46 UTC, forkit wrote: Is it possible to create a package.d, consisting of (for example), two modules, where each module can access private declarations within each other. For this to be possible: You must first collect all modules in the directory with the

Re: Can I create a package with friendly modules

2022-06-11 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 12 June 2022 at 05:05:46 UTC, forkit wrote: Is it possible to create a package.d, consisting of (for example), two modules, where each module can access private declarations within each other. In essence, declaring 'a module level friendship', or a kind of 'extended module' if you

Re: Can I create a package with friendly modules

2022-06-11 Thread forkit via Digitalmars-d-learn
On Sunday, 12 June 2022 at 05:05:46 UTC, forkit wrote: e.g. If I could something like this: // foo_1.d module foo_1 private int a; // a is private to module foo_1 // foo_2.d module foo_2 private int b; // b is private to module foo_2 // foo.d module foo[dependencies:foo_1, foo_2]; import

Can I create a package with friendly modules

2022-06-11 Thread forkit via Digitalmars-d-learn
Is it possible to create a package.d, consisting of (for example), two modules, where each module can access private declarations within each other. In essence, declaring 'a module level friendship', or a kind of 'extended module' if you want. I might still want to add another module to the