r/cpp_questions 9d ago

OPEN What’s the state of modules

I’ve been hearing about modules since a while now and I can’t seem to find any serious project on the internet using modules. I assume compilers still don’t fully support modules…

7 Upvotes

13 comments sorted by

View all comments

6

u/nysra 9d ago edited 9d ago

Most "serious" projects are first and foremost old and have either customers, momentum, or the sheer lack of time for proper refactoring holding them back. This is the primary reason for why we cannot have nice things, people are in general really bad at keeping the good things from the past and hang on too much to the bad ones.

Then comes the general problem with module implementations being super slow because for some reason people decided to keep the absolutely stupid idea of header imports in instead of making a proper break.

And one of the biggest issues is not just the language itself but rather everything around it. Projects would switch to modules a hell lot faster if import std; worked properly but it still requires setting some experimental flags in CMake and those change from version to version so most people don't bother looking that up all the time. Once the buildsystem support is there, it will get much better.

That being said, there are definitely projects trying out modules. IIRC fmtlib has some support for it already, but I haven't used it myself yet.