Live data from Hacker News

Are We Modules Yet?

arewemodulesyet.org

21–30 of 94 posts

Re: Are We Modules Yet?

#21

Estimated completion by 3892 is cute, but not surprising really given that only 1/4 compilers and 1/3 stdlibs support these completely. Presumably most projects aren't going to try to migrate until it's more generally available (I haven't looked at them in years, not sure if it's easy or possible to support it for one toolchain but not another).

No compiler comes to close to completely supporting modules. MSVC is the furthest along and it does not by any means fully support modules. I think an upcoming version will finally have somewhat usable support for import std;

Re: Are We Modules Yet?

#23
post #11

for the wizards where would be a good place to start for someone who did a python bootcamp but wants to learn C++ and contribute to some of these?

Learn Rust instead. This ship has holes.

Re: Are We Modules Yet?

#24
Some notes:

This website scrapes vcpkg's registry[1], which contains many C libraries which are unlikely to ever receive C++20 module updates. Many are primarily binary executable packages, like lunarg-vulkantools. It is quite unfair to judge C++ module support by this. There are even bugs in the table: the issue tracking Vulkan-Hpp module links to https://github.com/KhronosGroup/Vulkan-Hpp/issues/121, but it was actually implemented in https://github.com/KhronosGroup/Vulkan-Hpp/issues/1580 (full disclosure: I implemented it).

Boost maintainers have picked up on this[2], which is big.

The big 3 compilers have had a myriad of bugs, ICEs, and redefinition errors, despite what is claimed on cppreference[3]. VS 2022 17.10 will only just fix some of these, and G++'s module support isn't even released yet. Clang 18 has seemingly full(er) support for C++20 modules, but clangd is broken, and it seems mixing standard library headers and `import std` might still break, as will header units (`import `).

CMake released C++20 modules support with 3.28, and will release `import std` support with 3.30.

This is painful but IMO worth the paper cuts that the bleeding-edge adopters will experience in the next year or so as modules are implemented.

I fully believe that a good one-third to half of build time and power consumption in the past 40+ years of compiling C and C++ code (considerably more so in the case of template-heavy C++ header-only libraries and projects) has gone to parsing and re-parsing headers and the resultant output.

Headers are a distinctly 1970s approach to compartmentalisation. Other languages have sorted dependency and library/import resolution years ago; there's no reason the C and C++ world has to be stuck with essentially copy-pasting code over and over. The embarrassingly parallel building that results from headers is fake; it takes more time and more energy than strictly necessary.

[1]: https://vcpkg.link/browse/all

[2]: https://anarthal.github.io/cppblog/modules

[3]: https://en.cppreference.com/w/cpp/compiler_support/20

Re: Are We Modules Yet?

#25

As a longtime C++ user, I'd sooner just upgrade to a better system programming language. C++ is a weird mess.

Which one would you recommend? My ideal C++ alternative would be something like Swift but faster.

Just so you know, Rust is in many ways a lot like Swift, and not just because many Rust compiler devs went later to work on the Swift compiler.

Re: Are We Modules Yet?

#26
Standard library support is not there in any meaningful way across compilers, I fail to see why anyone would adopt modules at the present. MSVC is the furthest along in its support last I looked. Once compiler support is available, I would expect usage to increase fairly rapidly. As with many things C++, modules are a nice-to-have, adopting a successful strategy from other languages/ecosystems, and many will choose to never adopt them.

Re: Are We Modules Yet?

#27

As a longtime C++ user, I'd sooner just upgrade to a better system programming language. C++ is a weird mess.

Which one would you recommend? My ideal C++ alternative would be something like Swift but faster.

For low-level compiled system applications: Rust, Zig etc.

For compiled garbage-collected applications (web/cli): Go.

For high-level applications (web/cli/etl/desktop): Java, C#.

Also here is good writeup: https://hackernoon.com/the-real-c-killers-not-you-rust

discussed here two times:

https://news.ycombinator.com/item?id=34792932

https://news.ycombinator.com/item?id=39770467

Re: Are We Modules Yet?

#28
post #2

I feel that the site would benefit from a paragraph or two about what C++ Modules are and why devs should use them

You know any other language that uses the header/cpp split likes C/C++ do?

This is C++es way of finally getting rid of them, akin to Swift or Rust.

Re: Are We Modules Yet?

#30
post #22

Who all are doing the `arewe yet` Web sites, other than Rust and this C++ one?

It is a Mozilla culture thing that turned into a Rust thing, and yeah this is the first one I’ve seen outside of those two general communities so far.

Here is my, uh, “favorite” https://arewereorganizedyet.com/

Post reply on HN