Please integrate build framework into the compiler
grauzone
none at example.net
Sat Mar 21 13:19:31 PDT 2009
I don't really understand what you mean. But if you want the compiler to
scan for dependencies, I fully agree.
I claim that we don't even need incremental compilation. It would be
better if the compiler would scan for dependencies, and if a source file
has changed, recompile the whole project in one go. This would be simple
and efficient.
Here are some arguments that speak for this approach:
- A full compiler is the only piece of software that can build a
correct/complete module dependency graph. This is because you need full
semantic analysis to catch all import statements. For example, you can
use a string mixin to generate import statements: mixin("import bla;").
No naive dependency scanner would be able to detect this import. You
need CTFE capabilities, which require almost a full compiler. (Actually,
dsss uses the dmd frontend for dependency scanning.)
- Speed. Incremental compilation is godawfully slow (10 times slower
than to compile all files in one dmd invocation). You could pass all
changed files to dmd at once, but this is broken and often causes linker
errors (ask the dsss author for details lol). Recompiling the whole
thing every time is faster.
- Long dependency chains. Unlike in C/C++, you can't separate a module
into interface and implementation. Compared to C++, it's as if a change
to one .c file triggers recompilation of a _lot_ of other .c files. This
makes incremental compilation really look useless. Unless you move
modules into libraries and use them through .di files.
I would even go so far to say, that dmd should automatically follow all
imports and compile them in one go. This would be faster than having a
separate responsefile step, because the source code needs to be analyzed
only once. To prevent compilation of imported library headers, the
compiler could provide a new include switch for library code. Modules
inside "library" include paths wouldn't be compiled.
Hell, maybe I'll even manage to come up with a compiler patch, to turn
this into reality.
More information about the Digitalmars-d
mailing list