import with renaming and public import inside module

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Apr 27 17:52:48 PDT 2014


i wrote a module which public imports other modules (to avoid 
importing 'em by hand, 'cause import lists depends on version()). 
then i imported this 'main' module with renaming: import zmod = 
my.module;

now i can't acces any identifiers from modules that my.module 
public imports and i forced to copy-paste the whole my.module 
public import section each time. little sampe:

module my.module;
public import other.module;
…

module mainprogram;
import my.module;

now i can access other.module symbols without qualifiers


and another case:
module mainprogram;
import zmod = my.module;

now i CAN'T access other.module symbols without qualifiers. the 
only way to access 'em is to use horrible 
'zmod.other.module.symbol', which completely defeats my purposes 
for public imports in my.module.

can i use import renaming, but still access my.module public 
imports as if there was no renaming?

i don't want to fall back to struct/class namespace emulation 
hackery and i don't want to prepend all names in my.module with 
some prefix (and my.module have many widely-used names such as 
'init', 'deinit', 'write', etc).

the question is: is such behaviour of 'import' intentional, or 
this is just bug and it will be fixed eventually?


More information about the Digitalmars-d-learn mailing list