www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Module and package question

reply Dibyendu Majumdar <d.majumdar gmail.com> writes:
Is my understanding correct that package and module names form 
part of the name mangling?

Example:

module a.b.c;

void hello() {}

When compiled the function name will be mangled to include a.b.c?

Is it also true that the package and module name need not be 
associated with directory structure or file name?
Nov 14 2020
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Saturday, 14 November 2020 at 15:05:52 UTC, Dibyendu Majumdar 
wrote:
 Is my understanding correct that package and module names form 
 part of the name mangling?
yeah. even in D the full name includes it a.b.c.hello(); // will work once a.b.c is imported useful for disambiguating conflicting imports But this full name is what creates the mangle.
 Is it also true that the package and module name need not be 
 associated with directory structure or file name?
right.
Nov 14 2020
parent Dibyendu Majumdar <d.majumdar gmail.com> writes:
On Saturday, 14 November 2020 at 15:29:29 UTC, Adam D. Ruppe 
wrote:
 On Saturday, 14 November 2020 at 15:05:52 UTC, Dibyendu 
 Majumdar wrote:
 Is it also true that the package and module name need not be 
 associated with directory structure or file name?
right.
Thanks. I noticed that if I place a D source in a directory structure - say a/b/m.mod - and omit the module declaration, then the module name is part of the mangling but not the package. So package names always have to be declared in the module name?
Nov 14 2020