Article on incremental compilation

Steven Schveighoffer schveiguy at gmail.com
Sun Apr 23 18:04:00 UTC 2023


On 4/22/23 7:33 PM, Zachary Yedidia wrote:
> Hi everyone,
> 
> I've been tinkering with setting up incremental compilation in my D 
> projects by using `.di` files to ensure that a module is only recompiled 
> if its interface changes (not its implementation). I've written an 
> article about it here: 
> https://zyedidia.github.io/blog/posts/4-incremental-d-knit/. Hopefully 
> you find it interesting! Thanks!

Nice! Your build system sounds pretty cool.

On your section on "Areas for improvements in D interface files":

The previous section holds the answer -- templates. Templates must be 
included in full because they are instantiated by the caller. But a 
template can still use:

* private variables/functions
* private types
* private imports

etc. Basically anything that can be used in the implementation. The only 
thing that's hidden is non-template function implementations.

In order to avoid copying those things, the compiler would have to prove 
that no template inside the module can use these things.

One possible mechanism could be if *no* templates exist, it could 
exclude them. But to determine whether an existing template might use 
them, I believe is the halting problem.

So we are stuck with it.

-Steve


More information about the Digitalmars-d-announce mailing list