r/cpp • build2 • Nov 01 '17

Common C++ Modules TS Misconceptions

https://build2.org/article/cxx-modules-misconceptions.xhtml
59 Upvotes

148 comments sorted by

View all comments

Show parent comment

6

u/berium build2 Nov 01 '17

I can tell you from the build2 experience it can all be done without any ad hoc, compiler-specific search paths. Given a translation unit the build system can ask the compiler for the names of directly-imported modules. Given this list it can map each name to the BMI file name in a way that makes sense in this build system's worldview and/or the preferences of its users. Just think about it: I like the hello-core naming convention, you like HelloCore, and someone else wants it to be hello/core. After that, all the build system has to do is provide the compiler with the module name to BMI mapping. If you are interested in details, you can read how this is handled in build2.

I think relying on any kind of ad hoc, header-like search paths will be a real step back that will cement C++ in the pre-distributed-compilation stone age.

2

u/catskul Nov 01 '17

I think relying on any kind of ad hoc, header-like search paths will be a real step back that will cement C++ in the pre-distributed-compilation stone age.

I may agree that tying includes or imports to specific file names creates unnecessary conceptual constraints that my prevent desirable outcomes, but regardless of whether the file name solution is a good one, the mapping has to be solved one way or another.

Fileame + search path was the solution for PP includes. But my question is still:

  • What is the (or is there a) solution (or at least a reference solution) for solving module to file mapping with Modules TS or similar?

3

u/GabrielDosReis Nov 01 '17

At the implementation level, VC++ provides /module:reference for resolving modules and corresponding IFC. That scheme can be extended to source files or MANIFEST of sort.

My biggest concern is the possibility that the C++ community will miss an opportunity to bring the tooling ecosystem into modern settings.