Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-03 Thread Andrey Zherikov via Digitalmars-d-learn
On Friday, 3 November 2023 at 18:04:58 UTC, Jonathan M Davis wrote: - Jonathan M Davis Thanks a lot for detailed explanation!

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, November 3, 2023 5:20:56 AM MDT Andrey Zherikov via Digitalmars-d- learn wrote: > On Friday, 3 November 2023 at 00:52:18 UTC, H. S. Teoh wrote: > > Supposedly you can do this: > > /* Original: */ > > > > // pkg/mymodule.d > > module mymodule; > > ... // code here > > > >

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-03 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 3 November 2023 at 00:19:48 UTC, Andrey Zherikov wrote: Is there any guide how one can refactor single-module package into multi-module package with distinction between public and private modules? Call the modules literally anything else and it works better. So say you have module

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-03 Thread Andrey Zherikov via Digitalmars-d-learn
On Friday, 3 November 2023 at 00:52:18 UTC, H. S. Teoh wrote: Supposedly you can do this: /* Original: */ // pkg/mymodule.d module mymodule; ... // code here // main.d import mymodule; void main() { ... } /* Split */ //

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Nov 03, 2023 at 12:19:48AM +, Andrey Zherikov via Digitalmars-d-learn wrote: > On Thursday, 2 November 2023 at 19:43:01 UTC, Adam D Ruppe wrote: > > On Thursday, 2 November 2023 at 19:30:58 UTC, Jonathan M Davis wrote: > > > The entire reason that it was added to the language was to

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Andrey Zherikov via Digitalmars-d-learn
On Thursday, 2 November 2023 at 19:43:01 UTC, Adam D Ruppe wrote: On Thursday, 2 November 2023 at 19:30:58 UTC, Jonathan M Davis wrote: The entire reason that it was added to the language was to be able to split up existing modules without breaking code. And it does that well. No, it doesn't

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 2 November 2023 at 19:30:58 UTC, Jonathan M Davis wrote: The entire reason that it was added to the language was to be able to split up existing modules without breaking code. And it does that well. No, it doesn't do that well at all. In fact, it does that so extremely poorly

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, November 2, 2023 7:04:37 AM MDT Adam D Ruppe via Digitalmars-d- learn wrote: > On Thursday, 2 November 2023 at 12:52:35 UTC, BoQsc wrote: > > Therefore the need to import `package.d` is needed and I can't > > see a solution, which means > > tbh package.d should never be used. It is a

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 2 November 2023 at 12:52:35 UTC, BoQsc wrote: Therefore the need to import `package.d` is needed and I can't see a solution, which means that D Language might have to introduce a way to import `package.d` from inside the package, if there is a need to further improve experience

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Arafel via Digitalmars-d-learn
On 02.11.23 14:15, Arafel wrote: You simply can't expect to do `import waffle.foo` from within `waffle/` itself (unless you have another `waffle` folder in it, which is often the case). Sorry, this is wrong. It should read: You simply can't expect to do `import waffle.foo` **when invoking

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Arafel via Digitalmars-d-learn
On 02.11.23 13:52, BoQsc wrote: Well the whole thread is about importing `package.d` while being inside package to provide runnable working example which contains debug information of the package. Sorry, but I have never seen a package that includes examples within the package directory

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 2 November 2023 at 12:52:35 UTC, BoQsc wrote: Therefore the need to import `package.d` is needed and I can't see a solution, which means tbh package.d should never be used. It is a poorly designed, buggy misfeature of the language with plenty of better working alternatives (it

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread BoQsc via Digitalmars-d-learn
Well the whole thread is about importing `package.d` while being inside package to provide runnable working example which contains debug information of the package. Sidenote: This is essentially useful when distributing over many machines/platforms via `dub` package manager. You would want

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Arafel via Digitalmars-d-learn
On 02.11.23 12:57, BoQsc wrote: The current major problem is that it does not work on Windows operating system with either `rdmd` or `dmd`. While it does work on run.dlang.io. The problem is with your import path. If you say: ```d import waffles; ``` The compiler would search for either

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 2 November 2023 at 11:12:58 UTC, BoQsc wrote: Weirdly enough it does not work on Windows operating system. [...] ``` program.d(1): Error: unable to read module `waffles` program.d(1):Expected 'waffles.d' or 'waffles\package.d' in one of the following import paths: import

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 11:57:57 UTC, BoQsc wrote: On Thursday, 2 November 2023 at 11:32:40 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 11:12:58 UTC, BoQsc wrote: On Thursday, 2 November 2023 at 10:53:12 UTC, Arafel wrote: On 02.11.23 11:45, BoQsc wrote: [...] ```d ---

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread BoQsc via Digitalmars-d-learn
On Thursday, 2 November 2023 at 11:32:40 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 11:12:58 UTC, BoQsc wrote: On Thursday, 2 November 2023 at 10:53:12 UTC, Arafel wrote: On 02.11.23 11:45, BoQsc wrote: Edit incorrect link to example: [Extensive run.dlang.io

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 11:12:58 UTC, BoQsc wrote: On Thursday, 2 November 2023 at 10:53:12 UTC, Arafel wrote: On 02.11.23 11:45, BoQsc wrote: Edit incorrect link to example: [Extensive run.dlang.io example](https://run.dlang.io/is/f3jURn) Correct link:

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread BoQsc via Digitalmars-d-learn
On Thursday, 2 November 2023 at 10:53:12 UTC, Arafel wrote: On 02.11.23 11:45, BoQsc wrote: Edit incorrect link to example: [Extensive run.dlang.io example](https://run.dlang.io/is/f3jURn) Correct link: https://run.dlang.io/is/Zbrn75 ``` --- waffles/program.d import waffles; ``` See

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Arafel via Digitalmars-d-learn
On 02.11.23 11:45, BoQsc wrote: Edit incorrect link to example: [Extensive run.dlang.io example](https://run.dlang.io/is/f3jURn) Correct link: https://run.dlang.io/is/Zbrn75 ``` --- waffles/program.d import waffles; ``` See https://dlang.org/spec/module.html#package-module

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread BoQsc via Digitalmars-d-learn
Edit incorrect link to example: [Extensive run.dlang.io example](https://run.dlang.io/is/f3jURn) Correct link: https://run.dlang.io/is/Zbrn75

Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread BoQsc via Digitalmars-d-learn
![](https://i.imgur.com/829CzOS.png) Source File **package.d** is a [package module][1] which contains import statements to import other modules. How would one import a **package.d** module when [**keyword "package"**][2] is preventing that? [1]: