@simontoth @DanielaKEngert What do you mean self-contained?
I believe that is not correct: https://en.cppreference.com/w/cpp/language/modules (Exporting declarations and definitions)
You choose what to export and what not.
@simontoth @DanielaKEngert What do you mean self-contained?
I believe that is not correct: https://en.cppreference.com/w/cpp/language/modules (Exporting declarations and definitions)
You choose what to export and what not.
@lxsameer @DanielaKEngert Yes, and the things you export form your interface, which is public and needs to be self-contained (when someone imports this module, it needs to work as is, without importing/including other stuff).
@simontoth @DanielaKEngert sure. But that has nothing to do with partitions. I can't think of any module system in any other prog lang that in not like that.
@lxsameer @DanielaKEngert Other languages are not C++. Notably other languages typically conflate the concepts of namespaces, visibility and modules all into one thing.
@simontoth @DanielaKEngert Totally agree with that. No question.
But still, I yet to find a use case that partitions can solve but modules (cpp modules) can't.
@lxsameer @DanielaKEngert I suspect that you just haven't worked on a complex enough project.
This is not something new. For example Bazel build system allows you to express public and private partitions of libraries on the build system level. But to be fair, Bazel also offers a lot more nuanced way to control the visibility of interfaces, so C++ module partitions are not exactly a replacement.
@simontoth @DanielaKEngert I think a compiler is complicated enough, but I get your word for it.
I remain unsatisfied. If you ever encountered a use case for partitions that modules can't address, please tell me about it.
@lxsameer @DanielaKEngert A utility library that is only valid for one module is a perfect example of a private partition.
@simontoth @DanielaKEngert you can do that with modules as well. You just don't export them for publicly.
@lxsameer @DanielaKEngert No you cannot make a module that can only be imported by in one specific module.
Going back to what I said previously. If you only have modules, all your interfaces are public and must be self-contained.
@simontoth @DanielaKEngert
I this case, you don't need to define a new module.
If the utility library is supposed to be used in just ONE module. It has to live it the same module, there is no point moving it to another module or partition even.
Its implementation can be separated into a different file and you should not export its symbols. That's all. It's even simpler this way.
@lxsameer @DanielaKEngert So, again, as I said, your only option is then to have everything in one file, or fallback to headers and implementation files to structure your code.
@simontoth @DanielaKEngert
No, you don't have to. You can break your module into multiple files. There is no 1-to-1 mapping between modules and files. A module can be implemented in several files. There is one "primary module interface unit" for each module and as many "module implementation unit" as you want.
@lxsameer @DanielaKEngert OK I'm out... this is getting ridiculous. You are being deliberately obtuse.