NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
C++ Modules Are Here to Stay (faresbakhit.github.io)
reactjs_ 48 minutes ago [-]
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 have to rely on discipline and documentation to enforce clean code layering in C++.
Night_Thastus 16 minutes ago [-]
The fact that precompiled headers are nearly as good for a much smaller investment tells you most of what you need to know, imo.
rienbdj 17 minutes ago [-]
From 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?
w4rh4wk5 46 minutes ago [-]
https://arewemodulesyet.org/ gives you an overview which libraries already provide a module version.
srcreigh 27 minutes ago [-]
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.

cmovq 1 hours ago [-]
Can someone using modules chime in on whether they’ve seen build times improve?
nickelpro 37 minutes ago [-]
import std; is an order of magnitude faster than using the STL individually, if that's evidence enough for you. It's faster than #include <iostream> alone.

Chuanqi says "The data I have obtained from practice ranges from 25% to 45%, excluding the build time of third-party libraries, including the standard library."[1]

[1]: https://chuanqixu9.github.io/c++/2025/08/14/C++20-Modules.en...

luke5441 24 minutes ago [-]
Yeah, but now compare this to pre-compiled headers. Maybe we should be happy with getting a standard way to have pre-compiled std headers, but now my build has a "scanning" phase which takes up some time.
feelamee 1 hours ago [-]
why use modules if PCH on your diagram is not much worse in compile times?
nickelpro 36 minutes ago [-]
Macro hygiene, static initialization ordering, control over symbol export (no more detail namespaces), slightly higher ceiling for compile-time and optimization performance.

If these aren't compelling, there's no real reason.

bluGill 26 minutes ago [-]
modules are the future and the rules for are well thought out. Ever compiler has their own version of PCH and they all work different in annoying ways.
TimorousBestie 37 minutes ago [-]
I can’t deploy C++ modules to any of the hardware I use in the shop. Probably won’t change in the near-to-mid future.

It seems likely I’ll have to move away from C++, or perhaps more accurately it’s moving away from me.

bluGill 27 minutes ago [-]
If you tools are not updated that isn't the fault of C++. You will feel the same about Rust when forced to used a 15 year old version too (as I write this Rust 1.0 is only 10 years old). Don't whine to me about these problems, whine to your vendors until they give you the new stuff.
juliangmp 5 minutes ago [-]
My experience with vendor toolchains is that they generally suck anyway. In a recent bare metal project I chose not to use the vendor's IDE and toolchain (which is just an old version of GCC with some questionable cmake scripts around it) and instead just cross compile with rust manually. And so far its been a really good decision.
krior 10 minutes ago [-]
Nobody is "whining" to you. Nobody is mentioning rust. Your tone is way too sharp for this discussion.
Joker_vD 10 minutes ago [-]
> whine to your vendors until they give you the new stuff.

How well does this usually work, by the way?

TimorousBestie 8 minutes ago [-]
If C++ libraries eschew backward compatibility to chase after build time improvements, that’s their design decision. I’ll see an even greater build time improvement than they do (because I won’t be able to build their code at all).
whobre 1 hours ago [-]
> auto main() -> int {

Dude…

few 41 minutes ago [-]
And their code example doesn't actually return a value!
Davidbrcz 40 minutes ago [-]
For main it's explicitly allowed by the standard, and no return is equal to return 0
GrowingSideways 14 minutes ago [-]
[dead]
CamperBob2 56 minutes ago [-]
It's like calling a Ford Mustang Mach-E the "Model T++."
on_the_train 1 hours ago [-]
It's been the go-to syntax for 15 years now
Night_Thastus 22 minutes ago [-]
Go-to? I've never seen a project use it, I've only ever seen examples online.
GrowingSideways 15 minutes ago [-]
[dead]
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 20:12:53 GMT+0000 (Coordinated Universal Time) with Vercel.