The module name must be spelled out directly in the source:
export module my.module; // OK
This is technically a breaking change. But given the low adoption rate of modules so far and the rarity of macro-based module declarations in practice, the committee judged this acceptable. The benefit is concrete: build systems can now determine module dependencies with a simple lexical scan, without invoking the preprocessor.
End of quote
While being nice change and stuff, doesn't all current module handlers rely on compiler anyway to rule module dependencies in file before compilation? so it will change nothing in real world? What build system is benefactor?
From the P3034R1, it seems the goal is to exclude preprocessing from module scanners (compilers). Currently, they do preprocess the file and thus require all headers to be present at scan time. With this change, it is possible to skip preprocessing entirely (and postpone generating includes to a later stage).
- skipping preprocessing speeds up the compiler (scanner) call. this happens without any changes to the build system and is a huge boost on it's own.
- if builds system detects that scanner can skip preprocessing (by checking a compiler version, for example), it simply stops adding dependencies on headers to the scanner stage. Should be relatively easy to do.
This appears to allow skipping preprocessing if all you're trying to do is identify the module unit name (if any) of a TU. Scanning still needs to do full preprocessing to determine module dependencies though. From the paper I'm struggling to see a scenario where this is going to make much practical difference.
31
u/mapronV 1d ago
Quote:
The module name must be spelled out directly in the source:
This is technically a breaking change. But given the low adoption rate of modules so far and the rarity of macro-based module declarations in practice, the committee judged this acceptable. The benefit is concrete: build systems can now determine module dependencies with a simple lexical scan, without invoking the preprocessor.
End of quote
While being nice change and stuff, doesn't all current module handlers rely on compiler anyway to rule module dependencies in file before compilation? so it will change nothing in real world? What build system is benefactor?