nested module problem
Jean-Louis Leroy via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Sep 2 14:24:19 PDT 2017
On Saturday, 2 September 2017 at 20:48:22 UTC, Moritz Maxeiner
wrote:
> So the compiler wants you to import it by the name it has
> inferred for you (The fix being either specifying the module
> name in foo/bar.d as `module foo.bar`, or importing it as via
> `import bar;` in foo.d).
> [1] https://dlang.org/spec/module.html
I thought of doing that, it merely changed the error. OK now I
have:
in foo.d:
module foo;
import foo.bar;
in foo/bar.d:
module foo.bar;
$ dmd -c foo.d foo/bar.d
foo/bar.d(1): Error: package name 'foo' conflicts with usage as a
module name in file foo.d
If I compile separately:
jll at ORAC:~/dev/d/tests/modules$ dmd -I. -c foo.d
foo/bar.d(1): Error: package name 'foo' conflicts with usage as a
module name in file foo.d
jll at ORAC:~/dev/d/tests/modules$ dmd -I. -c foo/bar.d
It believes that 'foo' is a package...because there is a 'foo'
directory?
I see that a workaround is to move foo.d to foo/package.d but I
would like to avoid that.
More information about the Digitalmars-d-learn
mailing list