Thread overview
Module and package question
Nov 14, 2020
Dibyendu Majumdar
Nov 14, 2020
Adam D. Ruppe
Nov 14, 2020
Dibyendu Majumdar
November 14, 2020
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?


November 14, 2020
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.
November 14, 2020
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?