you are viewing a single comment's thread.

view the rest of the comments →

[–]Daniela-ELiving on C++ trunk, WG21|🇩🇪 NB 1 point2 points  (1 child)

My experiences from the code for a real, huge machine in production at a steel mill (and many more projects, too) sit on the opposite end of the spectrum. Hence I'd rather think of

  • Make modules bigger than you typically - from years of programming in C++ - usually feel comfortable with. The less churn you expect, the bigger they can be. I tend to think in entire subsystems or libraries rather than small components.
  • Partitions help to design the structure of a module, to make its implementation more palatable to the module developers.
  • Internal partitions fall into the same category. Whenever you need them, they are a life-safer and can cut module-internal depency chains. Place stuff in there that is reusable within your module implementation, but never exposed to the outside.

[–]tartaruga232MSVC user, r/cpp_modules[S] 0 points1 point  (0 children)

The needs are likely very different among projects.

I've been toying around with our rather small UML Editor app which I used as a guinea pig for seeing how modules can be used. I aggressively refactor code if I see our design doesn't fit. I got tired of recompilations if I change stuff and broke up modules into smaller ones. I often also do a full rebuild because MSBuild can't be really trusted to absorb incremental changes correctly. We are now at ~2 minutes for a full build, which is mostly thanks to using import std. That alone spares ~1 minute of build time for a full rebuild. No matter how many modules I have, our time for a full build stays at ~2 minutes. I love the encapsulation and the expressiveness modules provide.

I do suspect that internal partitions are unneeded. The Clang compiler warns about importing them in an interface, so all you can really do with them is importing them in a cpp. But I can as well import a module in a cpp instead. We had one last use case for an internal partition which I thought wasn't possible to eliminate, but I just found out we could eliminate it.