On 9/26/20 3:33 AM, 60rntogo wrote:
I have a package with the following structure:
pack
|- foo.d
|- bar.d
|- package.d
and the modules look like this:
---
module pack.foo;
struct Foo {}
---
module pack.bar;
import pack : Foo;
---
module pack;
public import pack.foo, pack.bar;
---
and this is an error: "struct pack.foo.Foo at source/pack/foo.d(3,1)
conflicts with alias pack.bar.Foo at source/pack/bar.d(3,8)". I seems
like the import in package.d sees Foo both in pack.foo and pack.bar, but
I don't understand why this happens since the import in bar.d is
private, isn't it?
A selective import is equivalent to aliasing (to the public) the symbol
as if it were defined in that scope.
You have to label it as private if you want it to be private.
-Steve