On Friday, 19 September 2014 at 05:17:45 UTC, Walter Bright wrote:
On 9/18/2014 9:48 AM, Scott Wilson wrote:
Im running some tests with D. Was wondering whats the
dependency
story. Cant find any info online, searched for dlang dependency
management and dlang dependency. Found bunch o dub stuff but
not
the nitty gritty.
Unit of compilation is one D file but I saw if I pass several D
files to the compiler only one .o file is generated. Whats the
story there.
The idea is to essentially "pre-link" the object files that
would have been generated if the files were compiled
individually into one object file. This is faster and more
convenient.
It also means that semantic analysis is done only once for each
file, and the imports, rather than doing it over and over as is
done with separate compilation.
Plus if I change a non template function in one module then
theres no way to tell make no rebuild of modules importing it.
The dmd -deps call seems to generate all recursively. In
gcc/makedepend if one function changes only relinking is needed
or nothing if dynamic loading.
Dependency management is the same as in C++, if you are willing
to use .di files to represent 'headers' of corresponding .d
files.
Overall as far as I understand compiler is fast but dependency
mgmt is coarse. Also whats the deal with cyclic dependencies. I
saw discussion that its not possible but wrote a few test
modules
and it works fine.
If two modules import each other, then if one changes, both
should get recompiled.
Im worrying about recursive dependencie. If a.d imports b.d and
b.d imports c.d then I change c.d. Is a.d compiled again?
Sometimes it should sometimes it shouldnt.
Scott