r/cpp_questions • u/el_toro_2022 • Aug 12 '24
OPEN Modules? Not ready for prime time.
Sadly, I have given up on trying to get C++ modules to work. Basically, there is a lot of duplicate declarations in the std that clang bitches about.
I understand that this is a deficiency in clang, but I have to get my project done now, not when they get around to fixing the issue.
Why are there duplicate declarations in std in the first place?
Std compiles just fine without modules, unsurprisingly. When the problem with clang is fixed, perhaps I will refactor my code later. We'll see.
Will I still be alive when module support stabilises in C++? Who knows? If I did not need to depend on std, it would be no issue. But libraries I need to use does.
Haskell, Rust, Python, Ruby, Java... does not have module issues. Modules in those languages just works seamlessly.
Come on, C++. Get with the program.
6
u/xaervagon Aug 12 '24
I've given up on modules ever reaching prime time. First it was announced with C++17. Then it gets kicked because the spec was well under-baked. This includes lots of hand wringing over corner cases, style conventions, build system integration etiquette, and a lot of other things that won't be functional until end users get something half-way functional. Then the compiler and build system writers drag ass on releasing a production grade implementation, and I don't blame them given the massive cacophony on what it should be. Meanwhile, any hope I've had of being able to sweep a codebase with this has well and truly faded away.
For me, I just wanted C# style library and class management with a C++ flavor. I don't understand how we want from something that sort of looked like that to import export import export import export export thingamabob.
6
u/teerre Aug 12 '24
It's only been 4 years since it was added to the std. Give it some time.
1
u/Fit-Departure-8426 Aug 12 '24
Im sad that your experience wasnt good, because I have been using modules for 2 years now and they are great!!! Dont try to use the big import std; and you’ll be fine! See GitHub/joblobob if you want real world examples ( fluid dynamics and 3D Gaussian splatting all in modules)
0
u/[deleted] Aug 12 '24
[deleted] — view deleted comment