4 ms·
I don't think you're missing something. The standards committee made a bad call with "no submodules", ran into insurmountable problems, and doubled down on the
by groby_b 9mo ago
I don't think you're missing something. The standards committee made a bad call with "no submodules", ran into insurmountable problems, and doubled down on the bad call via partitions.
"Just one more level bro, I swear. One more".
I fully expect to sooner or later see a retcon on why really, two is the right number.
Yeah, I'm salty about this. "Submodules encourage dependency messes" is just trying to fix substandard engineering across many teams via enforcement of somewhat arbitrary rules. That has never worked in the history of programming. "The determined Real Programmer can write FORTRAN programs in any language" is still true.
- bluGill 9mo agoThe C++ committee tries to do features with room for future extension. They believe that whatever you want from sub-modules is still possible in the future - but better to have a small (as if modules is small) thing now than try for perfects. We can argue about submodules once we have the easy cases working and hopefully better understand the actual limitations.
- groby_b 9mo agoNot to put too fine a point on it: The world has 35 years of experience with submodules. It's not rocket science. The committee just did what committees do. And sure, "future extension" is nice. But not if the future arrives at an absolutely glacial pace and is technically more like the past. This may be inevitable given the wide spread of the language, but it's also what's dooming the language to be the next COBOL. (On the upside, that means C++ folks can write themselves a yacht in retirement ;)
- bluGill 9mo agoThat is 35 years of different things tried, some that work better than others, some that are not compatible with others. Trying to figure out what is the best compromise while also making something that doesn't break existing code is hard when there are a lot of people who care.
- pornel 9mo agoJust getting to this barely-working state took C++ longer than it took to create all of Rust, including a redesign of Rust's own module system.
- pklausler 9mo agoFWIW, Fortran does have submodules.
- groby_b 9mo agoI suppose we shall amend to "The determined Real Programmer will fix FORTRAN" ;) But, for the folks who didn't grow up with the Real Programmer jokes, this is rooted in a context of FORTRAN 77. Which was, uh, not famous for its readability or modularity. (But got stuff done, so there's that)
- pklausler 9mo agoI'm so old, those jokes were about me.
- groby_b 9mo agoFogeys unite! ;) (They're about me, too)
- zabzonk 9mo agoI wrote a lot of F77 code way back when, including an 8080 simulator similar to that written by Gates and Allen used to build their BASIC for Altair. I don't know what language they wrote theirs in, but mine was pretty readable, just a bit late. And it was very portable - Dec10, VAX, IBM VM/CMS with almost no changes. I think F77 was a pretty well designed language, given the legacy stuff it had to support.
- fl0ki 9mo agoFascinatingly, I am not aware of any real issues with how Rust did nested modules. It even treated crates as top-level modules for most language-level purposes. I am sure there are nuanced reasons that C++ can't do quite the same, but the developer experience consequences can't be worth it.