7 ms·
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 buil
by Deganta 8y ago
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.
- gpderetta 8y agoThat's exactly how it has been specified.
- tcbrindle 8y agoExcept 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.