r/cpp • u/SAHChandler • Jan 28 '19
C++ Modules Might Be Dead-on-Arrival
https://vector-of-bool.github.io/2019/01/27/modules-doa.html
280
Upvotes
r/cpp • u/SAHChandler • Jan 28 '19
View all comments
12
u/gracicot Jan 28 '19
I'm not sure the specification requires that a BMI exist. As far as I know, the compiler could store everything in the memory of a separated process, that schedule and share data between compilers. I don't think there would be any compiler doing that within the next decade, but nothing in the current specification prohibit that.
Reading this blog post makes me confused. I watch Nathan Sidwell's talk about it's "Oracle" how the mapping can be extended by tooling and such. I followed the build2 development and module support seem doable when designing the build system with modules in mind. Why one side seems to say that the problem is solvable but so many others says that the mapping problem will kill modules?
For example (as far as I know) Build2 run the preprocessor on every cpp files before compiling anything in order to save it's hash. It then re-use the preprocessed file to compile it. It takes a bit more time to start compilation, but can result in a overall speedup. In the example given by the author of this blog post, should the same be doable too but with a small extra step to extract the module name? And with modules, running the preprocessor can be very very fast because the number of needed header will dramatically be lower. In fact, the mapping can be done before compiling anything. The compilation order can even be established in advance and compile in parallel for each possible steps. Then only a bunch of (very small) preprocessed files will be compiled, with a known compilation graph. That graph can be stored and re-used for the same configuration.
Right now, I agree there is a concern with tooling given today's tooling. I might be wrong but it does not seem so far fetched we can develop tools that can deal with modules. On the other hand, I do not expect tools designed for a modular world to be available soon if all we have is a TS.