On Friday, 29 April 2016 at 14:50:34 UTC, Dicebot wrote:
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.
That means that using the layout above, there is no way to
compile individually "main.d" or a file named "bar.d" with
"import xxx.foo;" ??
What if I want to make a library out of bar.d without totally
compiling foo.d?
I understand there must be some analysis of foo.d to get its
interface (basically get the ".di" version of it) but it should
not have to compile its implementation.