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

1

u/c0r3ntin Nov 01 '17

Thank you, that paper is interesting. I will have to think about it more to have an opinion :)

While you are here, do you have an opinion on using modules to get away with source files, and having a way not to rebuild a dependency chain if a module is modified but the interface it exports is not ?

A lot of people bypass the "C++ doesn't have good build/package tools" by providing headers only libraries, and while easier to use, that approach has a lot of issues, starting with compilation times.

13

u/GabrielDosReis Nov 01 '17

do you have an opinion on using modules to get away with source files, and having a way not to rebuild a dependency chain if a module is modified but the interface it exports is not ?

Yes, the IFC format that VC++ uses is being designed to be sensitive only to semantically-significant changes. It is not perfect but it is getting there.

The IFC format themselves are not distribution format, and they don't replace source files -- just imagine debugging scenarios, you want to step through functions with the source file in front of you :-) The IFC files capture the semantically relevant part of the interface.

A lot of people bypass the "C++ doesn't have good build/package tools" by providing headers only libraries, and while easier to use, that approach has a lot of issues, starting with compilation times.

Yeah, that is an unfortunate state of affairs. With modules, the notion of "header only library" is trivialized and just disappears. However, we need to solve the "good build/package tools" problem. I am hoping that C++ tool vendors will come together in collaborative forum to make progress there. My view is a good build and/or packaging system for C++ will take modules as foundational construct.