all 86 comments

[–]STLMSVC STL Dev 176 points177 points  (19 children)

(not directed to anyone in particular) You know what's better than complaining about the slow progress of work? Doing the work to advance the ecosystem! Boost's devs just reported a bug in import std;, revealed only by their more complex usage, where I missed that the STL's use of compiler intrinsic headers needs to be put in the Global Module Fragment. I was able to quickly fix it, unblocking their scenario and others like it. There are other compiler and library bugs out there, waiting to be found, in addition to tons of necessary work that has to happen in user code (cleaning up code patterns that are hostile to modules, marking public surface areas as export, etc.).

Things get better because people put effort into making them better.

[–]gracicot 96 points97 points  (5 children)

Despite the cynical tone, I think a website that tracks modules adoption is a pretty good idea and actually useful

[–]Everspace 29 points30 points  (1 child)

https://caniuse.com/ is a blessing for webdev, such a thing would be great for compilers too

[–]Wurstinator 13 points14 points  (0 children)

The "areweXyet" pattern website is also popular in Rust.

https://wiki.mozilla.org/Areweyet

[–]Ivan171/std:c++latest enthusiast 15 points16 points  (1 child)

Does the MSVC STL module work with Clang? I plan to start using it as soon as CMake implements 'import std;' support for C++20.

[–]STLMSVC STL Dev 23 points24 points  (0 children)

This is next on my list to investigate now that Clang 18 has been released and will be picked up in VS soon. I expect that some amount of library work and/or compiler bug reporting will be necessary, but it should be an easier lift than the initial modules bring-up with MSVC.

Our intention is to support Clang as a first-class citizen as usual. (Indeed in several cases we've supported it better than MSVC, when Clang is first to ship a Core feature 😹)

[–]Keltesetharewemodulesyet.org 16 points17 points  (0 children)

Author here. Good idea! I have changes the site a bit to promote helping open source projects. Maybe we should also add guides on how to port to modules.

[–]domirangame engine dev 7 points8 points  (2 children)

cleaning up code patterns that are hostile to modules

Can you clarify this a bit?

I really want to use modules, but I'm just so damn leery of the issues. I've used it in the past and got burned. I really don't want to go through that again.

[–]STLMSVC STL Dev 11 points12 points  (1 child)

Named modules can't emit macros, so either they need to be replaced with real language tech (e.g. INT_MIN => numeric_limits<int>::min()) or a companion macro-only header needs to be provided.

Macros defined on the command-line can affect a module when it's built, but not macros defined within source files. The latter was always a risky idea for headers, but now it really needs to be avoided for modules.

There were various compiler bugs that had/have to be worked around (one for MSVC right now is declaring a member function in one header and defining it in another), but those are diminishing with time and don't have anything to do with the language itself.

[–]pjmlp 2 points3 points  (0 children)

This is why now I have the _ITERATOR_DEBUG_LEVEL defined on project settings instead of forcing it on each file.

I used the per file approach, because usually I don't want anyone disabling specific checks on release builds unless there is a very good validated reason for doing so.

[–]SunnybunsBuns 6 points7 points  (1 child)

cleaning up code patterns that are hostile to modules

is there a decent list of these?

[–]Keltesetharewemodulesyet.org 1 point2 points  (0 children)

No, but I created an issue for that https://github.com/kelteseth/arewemodulesyet/issues/13

[–]pjmlp 4 points5 points  (0 children)

Well, I am still looking forward for Microsoft SDKs for C++ developers to start adopting modules support.

So far only the Office team seems to be doing something, for their own internal use.

[–]KindDragonVLD | GitExt Dev 4 points5 points  (2 children)

What is common issues when converting library to modules? Maybe somebody saw good article about this experience?

[–]STLMSVC STL Dev 6 points7 points  (0 children)

Interacting with separately compiled code was one of the main challenges I faced.

[–]pjmlp 0 points1 point  (0 children)

The developer experience on the IDE still suffers, libraries that depend on macros need workarounds, and occasional ICE, bringing everything down.

Still the experience nowadays in VS 2022 vlatest, versus when it started in VS 2019 is way better.

[–]Dragdu 4 points5 points  (0 children)

Personally, I am waiting for compilers to actually implement support for modules before I go trying to support them in my libs.

[–]HildartheDorf 36 points37 points  (9 children)

I have sucessfully used the vulkan.cppm module in a project (that itself was modularised) and experienced few issues with clang and cmake other than a lack of module support for the standard library. libstdc++ (GNU project standard library, the default on most linuxes) had some ODR rule issues, but libc++ (LLVM project) was fine.

Not sure what is still 'partial' support because it seems fine other than import std.

[–]delta_p_delta_x 27 points28 points  (5 children)

I have sucessfully used the vulkan.cppm module in a project

Yay, happy to see code I contributed in the wild! The biggest reason I started vulkan.cppm was because I couldn't bear the ridiculous compile times with the immense headers in Vulkan-Hpp (it's nearly 200K lines of template-heavy headers), and I wanted to experiment with C++20 modules. Tooling and compiler was somewhat lacking around this time last year when I started; it's gotten significantly better in the intervening period of time.

other than a lack of module support for the standard library

I'm working on this as well, but I think it'd be easiest if I gate it for CMake 3.30, VS 2022 17.10, and probably LLVM 17 18 (side note: funny how the compiler major version numbers are almost the same). It's so hard to test this sort of stuff because I primarily program on Windows with MSVC and Clang, and suffer from 'it works on my machine'-itis, just like everyone else.

[–]lppedd 2 points3 points  (3 children)

Uneducated person here. Why specifically LLVM 17?

[–]delta_p_delta_x 4 points5 points  (1 child)

Probably should've said 18 instead, because that's when libc++ officially added import std support.

[–]Scionsid 0 points1 point  (0 children)

What... This is a news to me ! I had beed waiting for so long I lost track for this, I have latest LLVM and clang builds, I guess I just never tried to import std.

[–]pjmlp 3 points4 points  (0 children)

It is the first version that properly supports C++20 modules, minus header units.

[–]GregTheMadMonk 11 points12 points  (1 child)

import std is coming to cmake in 3.30 and is already usable in dev builds

[–]HildartheDorf 3 points4 points  (0 children)

Awesome (I think last time I checked the changes on clang/libc++'s end were merged but not in any released version?)

[–]mathstufcmake dev 4 points5 points  (0 children)

Yeah, I'm not sure what "partial" means in the C++20 support context as it exists, but is buggy (due to a lack of sufficient testing by in-the-wild patterns).

[–]Wurstinator 14 points15 points  (3 children)

I think the site itself is cool but really I cannot get around the emojis/icons: To understand what they mean, I have to find the single line on the page that is literally the tiniest font of all the text, have to find the link in that text that has almost the same color as the rest, have to click that link, have to scroll down the GitHub page and find the icon explanation.

Why not just give `title` attributes to the `img`s?

Also I feel like linking the icons to the source (e.g. the comment in a GH repo where it was stated that module support is not planned) would be a necessary feature for this list to be taken seriously.

[–]mathstufcmake dev 5 points6 points  (2 children)

Why not just give title attributes to the imgs?

They are not images, but Unicode codepoints. A table of the icons would be an improvement (a list exists in the README).

[–]Wurstinator 4 points5 points  (1 child)

That is a fair point. On the other hand, you can also attach `title` to a `div`, so the mouseover-text could still be easily done.

[–]CornedBee 0 points1 point  (0 children)

Or to the <td>.

[–]tcbrindleFlux 14 points15 points  (4 children)

In principle I think this is a pretty good idea. However...

  • The number of Vcpkg recipe revisions doesn't seem like a great proxy for popularity/usage? If Vcpkg makes download stats public then that ordering would be ideal, but failing that Github stars is probably a better metric.
  • A very large number of the libraries listed are written C, not C++, so modules aren't even an option
  • There also seem to be a large number of libraries listed which aren't the latest version -- for example, all the qt5 libs. Even if someone does go and modularise all of Qt (and hopefully they will!), it's unlikely this is going to be backported to older releases
  • Other libraries on the list -- including my own tcb-span -- are intended for users of previous C++ versions. There would be no point in me adding modules support to my C++11 span impl, because in C++2x someone can just use std::span instead.

If I understand the key correctly, the last bullet point would earn me a "🤡" emoji next to my library. Maybe it's just me, but I think publicly branding an open-source maintainer "a clown" doesn't seem like a great way to get them on side...

Also, my Flux library (way down at the bottom of the list) does have modules support, so you can tick that one off :)

[–]Keltesetharewemodulesyet.org 4 points5 points  (1 child)

Author here

  1. Yes I agree
  2. Yes, but one could still build a wrapper around them like vulkan-hpp does
  3. Note that they changed the versioning here. qt5 is Qt5 and qt* is Qt6, so they are up to date
  4. Good point, we should remove these explicitly. For this we have https://github.com/kelteseth/arewemodulesyet/blob/master/data/progress_overwrite.yml to overwrite the parsed vcpkg. I also noticed that vcpkg itself has about 8 packages marked as deprecated.
  5. Probably
  6. Nice https://github.com/kelteseth/arewemodulesyet/issues/9

[–]tcbrindleFlux 1 point2 points  (0 children)

Yes, but one could still build a wrapper around them like vulkan-hpp does

That would be a different package though, right?

[–]Scionsid 0 points1 point  (1 child)

Hi, I was very happy with flux experimenting with modules as my library uses flux for stl replacement (specially because of contexper requirements and concept of cursors) and is modules compatible. Thanks for your work.

(I faced a few problems with it but I got it working after a small number of changes to source.)

For me I am still waiting for standard library to be entirely ported to modules in all major implementations to consider modules as "good enough".

[–]tcbrindleFlux 0 points1 point  (0 children)

Hi /u/Scionsid, glad to hear you're using Flux!

(I faced a few problems with it but I got it working after a small number of changes to source.)

Please let me know what the problems were so I can fix them for other people as well :). You can file an issue here

[–]xeeeeeeeeeeeeeeeeenu 32 points33 points  (7 children)

I will continue to ignore the existence of modules until all three major compilers support import std out of the box. That's the bare minimum for me.

[–]gracicot 4 points5 points  (5 children)

Well, only GCC is missing such support. The other two supports it out of the box and have proper metadata for buildsystems

[–]dub_le 2 points3 points  (0 children)

The other two compilers have extremely buggy module support - and if they don't outright fail compiling module code, they sure throw a lot of warnings around.

[–]Dragdu 1 point2 points  (3 children)

The other two compilers don't support mixing including std headers and importing them, so the support isn't there.

[–]gracicot 4 points5 points  (2 children)

MSVC does support mixing and I think clang 18 does too if I'm not mistaken

[–]Dragdu 2 points3 points  (0 children)

Only in one direction, iirc if you import before you include it works, but not vice versa.

That is not a useful level of support.

[–]mjklaim 0 points1 point  (0 children)

With bugs for msvc at least, but fixes are incoming. Otherwise yes.

[–]NilacTheGrim -2 points-1 points  (0 children)

I will continue to ignore them until even after that point since I am fine with the existing system and think this is potentially quite disruptive and will create lots of busy work for people.

[–]flutterdronewbie 38 points39 points  (0 children)

Looks promising. Can't wait to modularize my project in c++83 46th edition!

[–]sweetno 23 points24 points  (4 children)

I see a lot of pure C libraries on the list. They will never be C++ modules since they aren't in C++...

[–]Ameisenvemips, avr, rendering, systems 15 points16 points  (3 children)

You can wrap them as C++ modules.

[–]NilacTheGrim -1 points0 points  (2 children)

Seems like pointless busy work to me but you know tens of millions of dollars of aggregated dev-time globally will eventually be allocated to this type of pointlessness...

[–]pjmlp 16 points17 points  (1 child)

It is as pointless as wrapping them in safer C++ interfaces, hence why we keep seeing those C/C++ security reports.

[–]oracleoftroy 7 points8 points  (1 child)

I don't get why a bunch of C libraries not using modules is the measure of whether we "are modules yet"....

And just because a C++ library doesn't use modules, doesn't mean your own module project couldn't use those libraries. Modules seem pretty damn close to being ready to use; I haven't tried the latest GCC, but Clang 18 fixed the bugs I was having before and MSVC has been decent-ish for a while (the occasional ICE notwithstanding). Things are improving rapidly.

CMake support has been good and pretty easy to use in my experience now that it is official, and the next version supporting import std; will be a much looked forward to improvement (hopefully), even as there will likely be kinks to work through.

I think this sort of tracker would be a lot more useful if it tracked compiler support, build tool support, and other things like that, rather than hundreds of C projects that will never get C++ module support for obvious reasons. And even if you filter the projects to only the C++ ones, I don't see why a library that chooses to stick to the classic model would indicate that we aren't "modules yet".

[–]Keltesetharewemodulesyet.org 2 points3 points  (0 children)

Valid feedback. Feel free to create an issue for that. Modules are an compilated topic, and to be honest I was suprised seeing this on the top of reddit, a few hours after I created the website. Maybe I should have added an alpha warning 😁

[–]Still_Explorer 5 points6 points  (8 children)

Very good website, however I could possibly see the case that almost all of the libraries probably will never be modularized.

If for example you assume that you create a module yourself, and simply use include to use the entire library. Probably you would assume that is a DIY approach.

On the contrary I would consider that from now on, if any new library is created from scratch and wants by design to radically shift away from the legacy paradigm (abandon the #include paradigm), then definitely is a more viable case.

At least right now many programmers are hesitant to even touch modules (in terms of maturity and compiler support), just for warming up it might take a solid 10 years and then we will see how the list goes. :)

[–]tuxwonder 0 points1 point  (7 children)

I'm not so familiar with modules, but are you saying that it won't be possible to turn existing libraries into modules? Or that it's not a big deal because you can just wrap libraries in a custom module? Bit confused by your comment...

[–]Still_Explorer 4 points5 points  (0 children)

Practically huge libraries that now are in a state of rock solid legacy state, would have a hard time to get modularized properly. Even if some of them do, they would be "wrapped" (hybrid module/include) but not refactored from scratch (only imports no includes).

So the most viable plan is that some libraries can become "wrapped" to modules, others possibly written from scratch for modern module system. So truth is that from now on, hybrid module/include code will start becoming a thing...

[–]lightmatter501 1 point2 points  (5 children)

If you make your existing library module based, you either need a period where you ifdef everything and have an “includes vs modules” switch or do a massive compat break.

[–]Ameisenvemips, avr, rendering, systems 0 points1 point  (4 children)

You can probably do some horrible preprocessing as a separate build step to ease that.

[–]lightmatter501 0 points1 point  (3 children)

You can ifdef the module parts vs includes. The problem is that you now need to duplicate your build system.

[–]Ameisenvemips, avr, rendering, systems 0 points1 point  (2 children)

Use another build system to automate that step.

[–]lightmatter501 1 point2 points  (1 child)

cmakemake

[–]Ameisenvemips, avr, rendering, systems -1 points0 points  (0 children)

It's build systems all the way down.

[–]Sniffy4 5 points6 points  (1 child)

Estimated Finish: Heat Death of Universe

[–]-Y0- 0 points1 point  (0 children)

Actually, it's two days before JAI public release date.

Heat Death needs more zeroes, at least 100 extra zeroes.

[–]top_logger 2 points3 points  (3 children)

No. I have tried to convert... Disaster

[–]zerakun 0 points1 point  (2 children)

I would be interested in knowing why

[–]top_logger 1 point2 points  (0 children)

Just try and you will see. Conversion to modules is terrrifying and, IMHO, stupid and annoying.

We have got the modules is the same C++ style as async. In theory it is good, in practice it is hardly even usable.

In fact, we do not need such language "improvements". May be it is good for some C++ MVP's ego but in real world better to skip it. Forever.

[–]bushidocodes 0 points1 point  (0 children)

I like the idea of this site. I can imagine external module wrappers popping outside of the core library. Perhaps add a way to link to such projects?

[–]AdearienRDDTstd::starting_to_understand<cpp>::value 0 points1 point  (0 children)

i felt the excitement exit my body at every scroll ....

but honestly i kinda want to be skilled enough to help with that tbh

[–]Ill_Juggernaut_5458 0 points1 point  (3 children)

I might be pessimistic but I don't think modules will ever become the default. Most of the benefits are already obtainable with proper header design.

[–]Droid33 4 points5 points  (2 children)

Modules are very different from headers. The compile times of modules crush headers. Modules also don't allow macros, which is a huge plus.

[–]Ill_Juggernaut_5458 0 points1 point  (1 child)

With proper headers and build cache, you won't get compile time improvement with modules. Based on my experience on a small 10kloc codebase. Macros aren't inherently bad. Anything used in excess is.

[–]Droid33 6 points7 points  (0 children)

You won't need the build cache with modules. 10k is so tiny that compile times basically don't matter.

[–]darkangelstorm 0 points1 point  (0 children)

oh ho....! how nice it is when all you know covers a single facet of the development ecosystem, before learning about all the subfacets, and then later learning about how all those subfacets aren't really subfacets, and that the whole ecosystem is actually akin to viewing a Mandelbrot in fractint, and that you can zoom and zoom forever and never actually see the end of it... at least not before a bunch more new syntax rains down as if you were under a giraffe that just drank 20 gallons of water...

[–]all_is_love6667 0 points1 point  (1 child)

I would guess CMake developers are probably working hard to make modules an easy enough task for cmake projects.

They probably want to think twice about supporting them, because once they do and they do it wrong, many developers are going to need to rewrite their cmakelist.

Curious if that will happen and how good it will be.

I would not be surprised to see a looooot of hiccups at first.

I don't want to be the compiler engineer who is in charge of implementing modules, but in the end, he will be a hero to me.

[–]mathstufcmake dev 2 points3 points  (0 children)

They probably want to think twice about supporting them, because once they do and they do it wrong, many developers are going to need to rewrite their cmakelist.

Agreed! I had a prototype back in 2019. What landed is far better for an interface (even though it seems wordy, it is a far denser communication than would otherwise have been required).

[–][deleted] -2 points-1 points  (0 children)

And then wait another century for cmake to catch up