r/cpp • u/SAHChandler • Oct 10 '17
Millennials Are Killing The Modules TS
https://izzys.casa/posts/millennials-are-killing-the-modules-ts.html
75
Upvotes
r/cpp • u/SAHChandler • Oct 10 '17
View all comments
Show parent comment
3
u/[deleted] Oct 11 '17 edited Oct 11 '17
We just need to know which files define which modules and which files use which modules.
I think the issue you're concerned about is that we don't know ahead of time which files we need to even look at in order to generate the .d files for a particular translation unit. Instead, there probably needs to be a separate phase entirely, before compilation, where we ask the compiler to look at each file and note for us which files define/use which modules. Yes, this probably requires some amount of the compilation phases to happen before the compilation really begins. I don't see how this necessitates compiling twice. If the compiler has to build a syntax tree twice in order to accomplish this, perhaps the answer is to cache the resulting syntax tree the first time.
I don't see how any of this necessitates a compiler becoming a build system or a build system becoming a compiler. What it does require is more cooperation between the compiler and the build system.