IMO module names should be the same as the namespace of objects exported by the module (more like Modula-2). I've never used C++20, but modules do seem a bit of a mess.
Globally unique namespace names are needed to be able to differentiate the same name used in multiple namespaces, but of course are potentially a problem if you don't have control over them.
It might occasionally be useful if there was a workaround to resolve namespace clashes by doing something like:
namespace foo {
#include "foo/module.h" // namespace Module
using Module; // Module.x is now foo.x
}
namespace bar {
#include bar/module.h" // namespace Module
using Module; // Module.x is now bar.x
}
Or, we could invent a new syntax like "import foo/module as foo".
But AFAIK there is no way to then tell the linker to rename symbols to match (e.g. -l foo/module.o as foo -l bar/module.o as bar).
> But AFAIK there is no way to then tell the linker to rename symbols to match (e.g. -l foo/module.o as foo -l bar/module.o as bar).
Renaming symbols is done with objcopy. From objcopy(1):