Flat module import namespace causing collisions

Artur Skawina art.08.09 at gmail.com
Thu Feb 16 06:27:01 PST 2012


On 02/16/12 15:10, 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`.
> 
> 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.

I gave an example in the first message -- just having an "import"
statement with a basename equal to the current filename (minus the
'.d' suffix) already breaks.

"static import" does not import the module's symbols into the
current scope. It's not about finding a workaround, it's about
fixing a design flaw. (which wouldn't be 100% backwards compatible,
but perfectly acceptable at this stage)

artur


More information about the Digitalmars-d mailing list