Scope modules DIP rough messy draft.

luckoverthere luckoverthere at gmail.cm
Mon Oct 29 01:37:07 UTC 2018


// A.d /////////////////////////////////////////////////////////

module A;

public import A.B; // What happens here now ?

module B
{
    void foo();
}

// B.d ////////////////////////////////////////////////////////

module A.B;

void foo();

//////////////////////////////////////////////////////


Then consider code like this, which will compile fine, using the 
file with module A.B

import A.B;

A.B.foo();


But then when if you decide to change it and import A instead:


import A;

A.B.foo();


You are calling a different function from the same module name. 
As there are actually two difference instances of the module, 
module A.B can mean two different things depending on the 
circumstance.









More information about the Digitalmars-d mailing list