On Mon, Jul 15, 2013 at 9:55 AM, Peter Alexander <peter.alexander.au@gmail.com> wrote:
On Monday, 15 July 2013 at 15:45:47 UTC, Timothee Cour wrote:
---- src/foo/bar.d:
// infers 'module foo.bar;' instead of 'module bar;'
void barfun(){}
----

---- src/main.d:
import foo.bar;
void main(){}
----

dmd -Isrc src/main.d

And what if I compile it like this?

dmd -c src/foo/bar.d
dmd -c -Isrc src/main.d
// link later

I don't think this can work in general.

Yes I thought about that case. It would still work by passing the same -I flags:
dmd -c -Isrc src/foo/bar.d
dmd -c -Isrc src/main.d
// link later

When a file would be fully specified on the command line as above, the -I flag would specify the offset from which to compute the relative path. I think it's a simple rule that makes code more DRY and easy to refactor.