Cannot import module that has name of a package

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Thu Mar 22 07:36:19 PDT 2007


Hennrich Blöbaum wrote:
> Hi!
> 
> Look at this:
> 
[snip]
> 
> This gives error:
> test/foo.d: module test.foo module and package have the same name
> 
> 
> Is there any reason why this is blocked?

 > <test/foo.d>
 > module test.foo;

class bar {
     static void baz() {
         // ... Some function implementation ...
     }
}

 > <test/foo/bar.d>
 > module test.foo.bar;

void baz() {
     // ... Some completely different function implementation ...
}

 > <main.d>
 > import test.foo;
 > import test.foo.bar;

void main() {
     test.foo.bar.baz(); // which function does this call?
}



More information about the Digitalmars-d mailing list