dsimcha wrote:
== Quote from grauzone ([email protected])'s article
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.
I'm surprised that this could possibly be more efficient than incremental
compilation, but I've never worked on a project large enough for compile times
to
be a major issue, so I've never really looked into this.
Maybe incremental compilation could be faster, but dmd has a bug that
forces tools like dsss/rebuild to use a slower method. Instead of
invoking the compiler once to recompile all modules that depend from
changed files, it has to start a new compiler process for each file.
If incremental compilation were removed from the spec, meaning the compiler
would
always know about the whole program when compiling, I assume (correct me if I'm
wrong) that would mean the following restrictions could be removed:
1. std.traits could offer a way to get a tuple of all derived classes,
essentially the opposite of BaseTypeType.
2. Since DMD would know about all derived classes when compiling the base
class,
it would be feasible to allow templates to add virtual functions to classes.
IMHO, this would be an absolute godsend, as it is currently a _huge_ limitation
of
templates.
3. For the same reason, methods calls to classes with no derived classes could
be
made directly instead of through the vtable.
And you could do all kinds of interprocedural optimizations.
Of course, these restrictions would still apply to libraries that use .di files.
If incremental compilation is actually causing more problems than it solves
anyhow, it would be great to get rid of it along with the annoying restrictions
it
creates.
It seems Microsoft thought the same. C# goes without incremental
compilation. But for now, D's build model is too similar to C/C++ as
that you'd completely remove that ability.