Clarification about compilation model and the mapping of package names to directory.

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 29 07:50:34 PDT 2016


On 04/29/2016 05:32 PM, Bruno Medeiros wrote:
> Imagine you have a module "main.d" with the line `import xxx.foo;`, and
> you have a file "foo.d" with the module declaration `module xxx.foo;`.
> Now imagine the files are laid out like this:
> 
> src/main.d
> src/foo.d
> 
> Is this valid, should these files compile? Currently DMD will fail if
> each file is compiled individually (because it expects `xxx.foo` to be
> in "src/xxx/foo.d", *but* it will succeed if all files are supplied to
> DMD in the same command-line.

AFAIK yes, this is valid and shall compile (and there are quite some
projects relying on it). There is simply a missing feature for separate
compilation case to allow supplying import module paths manually.


More information about the Digitalmars-d mailing list