Here’s the thing I don’t get about module partitions: They only seem to allow one level of encapsulation. Program - Module - Module Partition whereas in module systems that support module visibility, like Rust’s, you can decompose your program at multiple abstraction levels: Program - Private Module - Private Module - Private Module - Public Module - Public Module Maybe I am missing something. It seems like you will…
I don't think you're missing something. The standards committee made a bad call with "no submodules", ran into insurmountable problems, and doubled down on the bad call via partitions. "Just one more level bro, I swear. One more". I fully expect to sooner or later see a retcon on why really, two is the right number. Yeah, I'm salty about this. "Submodules encourage dependency messes" is just trying to fix substandard…
C++ Modules Are Here to Stay
81–90 of 143 posts
Re: C++ Modules Are Here to Stay
#82I get by without modules or header files in my C++ projects by using the following guidelines: - Single translation unit (main.cpp) - Include all other cpp files in main - Include files in dependency order (no forward declarations) - No circular dependencies between files - Each file has its own namespace (e.g. namespace draw in draw.cpp) This works well for small to medium sized projects (on the order of 10k lines).…
Re: C++ Modules Are Here to Stay
#83I get by without modules or header files in my C++ projects by using the following guidelines: - Single translation unit (main.cpp) - Include all other cpp files in main - Include files in dependency order (no forward declarations) - No circular dependencies between files - Each file has its own namespace (e.g. namespace draw in draw.cpp) This works well for small to medium sized projects (on the order of 10k lines).…
I believe that's called a unity build. Really nice speedup.
Re: C++ Modules Are Here to Stay
#84I get by without modules or header files in my C++ projects by using the following guidelines: - Single translation unit (main.cpp) - Include all other cpp files in main - Include files in dependency order (no forward declarations) - No circular dependencies between files - Each file has its own namespace (e.g. namespace draw in draw.cpp) This works well for small to medium sized projects (on the order of 10k lines).…
Re: C++ Modules Are Here to Stay
#85Earlier quoted context omitted.
Wow, the way this data is presented is hilarious. Log scale: Less than 3% done, but it looks like over 50%. Estimated completion date: 10 March 2195 It would be less funny if they used an exponential model for the completion date to match the log scale.
Yeah, my personal opinion is that modules are dead on arrival, but I won't waste my time arguing with C++ enthusiasts on that.
Re: C++ Modules Are Here to Stay
#86I recently started a pet project using modules in MSVC, the compiler that at present has best support for modules, and ran into a compiler bug where it didn't know how to compile and asked me to "change the code around this line". So no, modules aren't even here, let alone to stay. Never mind using modules in an actual project when I could repro a bug so easily. The people preaching modules must not be using them ser…
Re: C++ Modules Are Here to Stay
#87Earlier quoted context omitted.
Yeah, my personal opinion is that modules are dead on arrival, but I won't waste my time arguing with C++ enthusiasts on that.
Nah I'm a C++ (ex?) enthusiast and modules are cool but there's only so many decades you can wait for a feature other languages have from day 1, and then another decade for compilers to actually implement it in a usable manner.
Re: C++ Modules Are Here to Stay
#88I get by without modules or header files in my C++ projects by using the following guidelines: - Single translation unit (main.cpp) - Include all other cpp files in main - Include files in dependency order (no forward declarations) - No circular dependencies between files - Each file has its own namespace (e.g. namespace draw in draw.cpp) This works well for small to medium sized projects (on the order of 10k lines).…
This might be OK for someone using your files (a bit like a header-only library) but not so great for team development.
Re: C++ Modules Are Here to Stay
#89From the outside looking in, this all feels like too little too late. Big tech has decided on Rust for future infrastructure projects. C++ will get QoL improvements… one day and the committees seem unable to keep everyone happy or disappoint one stake holder. C++ will be around forever, but will it be primarily legacy?
Yes. Unfortunately the committee has completely abandoned safety at this point. Even memory/thread safety profiles have been indefinitely postponed. The latest ghost safety lifetimes thing is completely unimplementable There literally isn't a plan or direction in place to add any way to compete with Rust in the safety space currently. They've got maybe until c++29 to standardise lifetimes, and then C++ will transitio…
Re: C++ Modules Are Here to Stay
#90C++ templates and metaprogramming is fundamentally incompatible with the idea of your code being treated in modules. The current solution chosen by compilers is to basically have a copy of your code for every dependency that wants to specialize something. For template heavy code, this is a combinatorial explosion.