Flat module import namespace causing collisions

Artur Skawina art.08.09 at gmail.com
Thu Feb 16 05:03:17 PST 2012

If you have a library with several modules, accessible with eg
"import lib.blah;" what happens if you try to use this lib module
from your app placed in a blah.d file? 

blah.d:6: Error: module blah from file lib/blah.d conflicts with another module blah from file blah.d

IOW, the default flat namespace is a really bad idea.
Adding a "module lib.blah'" line to lib/blah.d makes things work, but 
shouldn't be necessary; is there a reason why "import" is stripping
everything but the basename?
For non-renamed imports accessing the module (which should be rare)
using the full name (lib.blah in this case) will be enough.


More information about the Digitalmars-d mailing list