Re:C++ Modules Might Be Dead-On-Arrival
by Deganta on Monday January 28, 2019 @08:19AM
(#19017183)
They could just specify that the module/import statements need to be at the top of the file (excluding comments). Most people will do this anyway. Then the build system only needs to parse comments and module statements, which should be fast and easy.
[ Parent
| on HN ]
Re:C++ Modules Might Be Dead-On-Arrival
by tcbrindle on Monday January 28, 2019 @08:51AM
(#19017382)
Except that, as mentioned in TFA, as currently proposed it's possible to say
#if SOME_PREPROCESSOR_JUNK
import foo;
#else
import bar;
#endif
This has legitimate use cases, say #ifdef WIN32
import mymodule.windows
#else
import mymodule.posix
#endif
So in reality build systems will be required to invoke at least the preprocessor to extract dependency information.AFAIK the modules support in the Build2 build system does exactly this, and in fact caches the entire preprocessed file to pass to the compiler proper later.