import with renaming and public import inside module

Artur Skawina via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 29 03:56:58 PDT 2014


On 04/29/14 11:57, ketmar via Digitalmars-d-learn wrote:
> On Monday, 28 April 2014 at 15:57:16 UTC, anonymous wrote:
>> `zmod.symbol` works, too.
> no, it's not. at least on latest GDC.

It certainly works here; if it didn't it would be a frontend problem.

>> I don't think so. The point of the renamed import is that you have to use the new name.
> but i renamed only my.module, not others. nothing hints me that renaming is SO global. it's counterintuitive.

You did not /rename/ it, you *named* it - so now you have to use
that name to access all symbols inside the module, *including* any
symbols imported from other modules.

>> If you want the new name to be optional
> no, i don't. i don't want my.module symbols in global scope at all (it was static import in a fact, i relaxed it later).

I'm not sure what you want to achieve, but one solution could be
creating a module like:

   module mymodule;
   public import zmod = myzmodmodule;
   public import my.whatever1;
   version(blah)
      public import my.whatever2;

then:
   
   import mymodule;
   // ...    

>> As far as I can see, everything works as intended.
> so it's broken beyond any repair. so sad.

The D module system has a lot of problems and certainly needs
to be completely redesigned from scratch, but it does work as
documented and can already handle simple cases as yours.

artur


More information about the Digitalmars-d-learn mailing list