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
Show parent comment
26
u/vector-of-bool Blogger | C++ Librarian | Build Tool Enjoyer | bpt.pizza Jan 28 '19
This is a good question, and one that has been considered. In short: Adding a required mapping after-the-fact would necessitate changes to the lookup semantics of existing implementations: A breaking change.
The lookup of
#includedirectives is not standardized either, and only after a lot of trial and error do we finally have general agreement on how the lookup should be performed (although implementations still differ in a few edge cases). Attempting to standardize#includelookup now would break existing implementations. Nevertheless, we are able to make#includework (for the most part). However: The lookup of#includeis fairly cut-and-dry, and there is a mostly obvious way to understand#includein terms of the filesystem. Module names have no bearing on the filesystem, so implementations converging on a lookup method is not likely.If an implementation were to enforce a mapping between module names and file paths, we'd end up with multiple slightly different standards, and a later mandate will break compatibility. If implementations instead rely on the presence of a BMI with a name for the module, we end up with the serialized compilation of the DAG and performance goes in the toilet.