digitalmars.D.learn - Using local import path
- O/N/S (18/18) Sep 09 2016 Hi
- rikki cattermole (16/34) Sep 09 2016 A bit of a misunderstanding of what is going on with import and packages...
Hi Example: I have a module called "a.b.c"; and a second module called "a.b.c.d.e"; For importing i can use import a.b.c; import a.b.c.d.e; or with local names import abc = a.b.c; import abcde = a.b.c.d.e; Question: Is it possible to use something similar like following import abc = a.b.c; import abc.d.e; which would be a combination of a local renamed and enhanced path? I tried and it doesn't, could be a wrong using... Thanks & Regards, Ozan
Sep 09 2016
On 09/09/2016 8:08 PM, O/N/S wrote:Hi Example: I have a module called "a.b.c"; and a second module called "a.b.c.d.e"; For importing i can use import a.b.c; import a.b.c.d.e; or with local names import abc = a.b.c; import abcde = a.b.c.d.e; Question: Is it possible to use something similar like following import abc = a.b.c; import abc.d.e; which would be a combination of a local renamed and enhanced path? I tried and it doesn't, could be a wrong using... Thanks & Regards, OzanA bit of a misunderstanding of what is going on with import and packages there. In D there is no package import functionality that is implicit. So by importing a.b.c you're importing a module, not a package. This is key that it is a module and not a package. Because it is not required to expose other modules. Now to expose symbols to the importee via imports you will use public import. A public import basically says, hey I know about these symbols provided by another module but I want it accessible with mine. But we have a special module called package.d which when used e.g. a/b/c/package.d and imported as import a.b.c; which allows the emulation of a package importation. But remember because of public imports it does not have a special package symbol associated with it. Its just a plain old regular module. TLDR: no you cannot do what you were thinking.
Sep 09 2016
On Friday, 9 September 2016 at 08:25:40 UTC, rikki cattermole wrote:TLDR: no you cannot do what you were thinking.Seems like something one ought to be able to do, though. DIP time?
Sep 09 2016
On Friday, 9 September 2016 at 09:31:54 UTC, pineapple wrote:On Friday, 9 September 2016 at 08:25:40 UTC, rikki cattermole wrote:Where can I find DIP? Here? https://forum.dlang.org/group/issuesTLDR: no you cannot do what you were thinking.Seems like something one ought to be able to do, though. DIP time?
Sep 09 2016
On Friday, 9 September 2016 at 09:43:15 UTC, O-N-S wrote:On Friday, 9 September 2016 at 09:31:54 UTC, pineapple wrote:Here: https://github.com/dlang/DIPsOn Friday, 9 September 2016 at 08:25:40 UTC, rikki cattermole wrote:Where can I find DIP? Here? https://forum.dlang.org/group/issuesTLDR: no you cannot do what you were thinking.Seems like something one ought to be able to do, though. DIP time?
Sep 09 2016