Thread overview
Using local import path
Sep 09, 2016
O/N/S
Sep 09, 2016
rikki cattermole
Sep 09, 2016
pineapple
Sep 09, 2016
O-N-S
Sep 09, 2016
pineapple
September 09, 2016
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

September 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,
> Ozan

A 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.

September 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?
September 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:
>> TLDR: no you cannot do what you were thinking.
>
> Seems like something one ought to be able to do, though. DIP time?

Where can I find DIP? Here? https://forum.dlang.org/group/issues
September 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:
>> 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?
>
> Where can I find DIP? Here? https://forum.dlang.org/group/issues

Here: https://github.com/dlang/DIPs