What's the current state of the art for module compilation?

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Thu Nov 19 05:03:47 UTC 2026


On 19/11/2026 3:17 PM, Walter Bright wrote:
> On 11/17/2026 3:55 PM, David Given wrote:
>> - in order to use a module, the compiler needs access to the library 
>> (the compiled code), plus declarations. The declarations can be 
>> either .di files or the original .d source code.
> 
> Of course. How else could it work?
> 
>> - .di files are not to be trusted, as even though the compiler will 
>> generate them, it will silently break things like templates and 
>> functions which return auto.
> 
> Is there an issue filed for that?
https://github.com/dlang/dmd/issues?q=is%3Aissue+state%3Aopen+%22.di+generator%22

Some of these I think I (encouraged) did get solved.

https://github.com/dlang/dmd/issues/19644

Oh hey, I solved this one! https://github.com/dlang/dmd/issues/20296
Except nobody is using -extI :( So in practice it isn't actually solved.

But really the big problem is symbols go bye bye, as do function bodies 
that are needed for CTFE.

While we could make things a little more intelligent and add an 
attribute to say keep this body, what needs to change is non-private 
templates cannot access private symbols. However this requires so many 
more changes that I don't see this happening ever. It interacts with a 
bunch of stuff like dllexport, that I don't see it ever improving.



More information about the Digitalmars-d mailing list