Flat module import namespace causing collisions

Timon Gehr timon.gehr at gmx.ch
Thu Feb 16 08:19:22 PST 2012


On 02/16/2012 03:10 PM, James Miller wrote:
> I'm not sure what you are talking about, maybe explaining the terms
> and concreting down what you mean would help. Try posting a code
> example, demonstrating what you mean, rather than just throwing words
> around.
>
> There are various reasons why imports work they way they do, one of
> which is that D is supposed to be friendly to C/C++ programmers, so
> `import` behaves, on the surface, like `#include`.
>

It does not at all in this case.
Consider the following directory structure:

- a.cpp
+ b
   - a.cpp
   - a.h

$ cat a.cpp
#include "b/a.h"
$ cat b/a.h
void someusefulfunction();
$ gcc a.cpp -c
$ ls
a.cpp a.o


> If you want to only use the fully qualified names, just use `static
> import`, as far as I can tell, that is exactly what you want.
>
> --
>
> James Miller

Static import does not help.


More information about the Digitalmars-d mailing list