Nested public imports - bug or feature?

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 13 08:29:17 PDT 2015


On Thursday, 13 August 2015 at 13:44:50 UTC, rsw0x wrote:
> And we're back to namespaces : )

Not really.

This is namespace:

-----
module a;

struct Something
{
   static void foo() {}
}

module b;

import a;

void main() { Something.foo(); }
-----

This is import hygiene:

-----
module a;

void foo() { }

module b;

struct Something
{
     public import a;
}

void main() { Something.foo(); }
-----

Without that you risk breaking the code each time you add new 
symbol to a library - D module system is completely broken in 
that regard.


More information about the Digitalmars-d mailing list