Flat module import namespace causing collisions

Martin Nowak dawg at dawgfoto.de
Thu Feb 16 08:38:14 PST 2012


On Thu, 16 Feb 2012 14:03:17 +0100, Artur Skawina <art.08.09 at gmail.com>  
wrote:

> 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.
>
> artur

Yeah, it's a bad default.


More information about the Digitalmars-d mailing list