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.

Now, while it might not be the remit of the compiler to define a standard of the compilation model, and how source modules are supposed to be laid out in a project's directory, it is at the very least the responsibility of the DUB spec to do so.

And if DUB is to become the official bundle manager, this behavior should be clarified, because actually, this non standard layout currently works under DUB (because DUB supplies all source files in one single DMD invocation). But DUB and other tools need to know if this is actually valid or not, and if it's not, there should be some compiler switch to error out on situations like those.


FYI, this issue came up because the DDT IDE failed to understand such non-standard module layout, according to a user report ( https://groups.google.com/d/msg/ddt-ide/Qf8PeQcujbM/UcdRS7VKLwAJ ).


--
Bruno Medeiros
https://twitter.com/brunodomedeiros

Reply via email to