Hacker News new | ask | show | jobs
by pphysch 754 days ago
C++ indeed has many gems like RAII, and many turds. My hope is that one of the last unavoidable turds (mandatory header files) gets replaced by modules but that seems eternally on the horizon.

Frankly I haven't used C++ since LLM copilots dropped, so that would address a lot of the tedium with managing headers in rapid greenfield development.

2 comments

I have very mixed thoughts about headers, there is something I kind of love about being able to document the public declarations in one slim text file; and put the definitions elsewhere. There are lots of ways to do that, but other languages don't seem to bother. There are automated solutions, to pull these out, but I rarely see, for example, a python file will often just be a series of functions with no way to tell.

But they have a ton of warts, and require duplicate maintenance.

Python does enable this, actually. __init__.py can act as a "header" file that lets you define your porcelain interface separately from internal interfaces.
Typescript's .d.ts files are basically this
Modules nowadays mostly work, at least for VC++, clang 18 and cmake/msbuild.

My hobby C++ coding nowadays only uses modules.

For portable code, I imagine at least 5 years more, given experience with previous C++ standards.

I don't find the module workflow particularly valuable myself.

The main issue is that humans suck at defining module boundaries and managing dependencies.

Files are simple.

> The main issue is that humans suck at defining module boundaries and managing dependencies.

Thus microservices, nothing like putting process boundaries into what humans fail to learn to do properly, even better with a network in the middle.