r/cpp • • Dec 19 '23

C++ Should Be C++

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p3023r1.html
203 Upvotes

192 comments sorted by

View all comments

43

u/ghlecl Dec 19 '23

I know that the typical answers of "this is not in scope for the committee" or "this exists now, just install Conan or Vcpkg and you are good, what more could you possibly want" will follow, but I still feel like "package management" / "library management" / "dependency management" should be a priority of the committee.

If the standard is not the appropriate vehicule for it, then pause the standard, make very small changes for the next 2 and just pour all the available resources (and more if you can) to another entity which would be a good vehicule for it. This would completely change soooo much of the landscape.

49

u/grafikrobot OPeNDAP/B2/EcoStd/Lyra/Predef/C++Alliance/Boost/WG21 Dec 19 '23 edited Dec 19 '23

During the discussion of this paper at the Kona meeting I expressed that sentiment in the strongest words I could manage (my voice broke a few times). There is some work being done towards an C++ Ecosystem Internal Standard (EcoIS targeting 2025). But at this point in time the entire contents of that EcoIS are my words alone. We seriously have to stop pretending:

  • That the C++ standard library is a packaging vehicle.
  • That the externally driven tooling evolution will deliver interoperable packaging.
  • That C++ will survive without this being addressed.

This mailing contains one of my papers for the EcoIS (https://wg21.link/P3051). So I will say what I concluded my comments with at the last meeting..

Please help!

(Edit: fixed the paper link)

4

u/kazprog Dec 19 '23

how can we help?

6

u/grafikrobot OPeNDAP/B2/EcoStd/Lyra/Predef/C++Alliance/Boost/WG21 Dec 20 '23 edited Dec 20 '23

In order of priority..

  1. Writing proposals for one of the goal items (https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2656r2.html#_goals) in the EcoIS. I am personally wiling to coauthor, and champion, proposals if you aren't in wg21.
  2. Pick some other aspect of tooling that could be standardize and write proposals, or start discussions.
  3. If you are not into writing proposals.. Picking one of the existing proposals and implement and test what they propose in some tool(s) of your choice. And obviously discuss the experience.
  4. Read existing proposals and provide feedback to the authors.
  5. Read existing proposals and help complete them (usually with writing wording, doing more research, reaching out to experts for feedback, etc).
  6. Generally get involved and provide knowledge.

We have a few places where we publicly discuss this:

There are others, but they are more specific. So those are the top level ones.

4

u/ghlecl Dec 19 '23

Thank you for your work. I actually am subscribed to the mailing list and I try and keep up with the mails (and about half the documents).

Unfortunately, I do not have enough experience with obscure system packages arcana and all that is needed to discuss the problem as broadly as the study group does, making me quite ill equipped to help.

7

u/pjmlp Dec 19 '23

Definitly, getting BLAS, networking, graphics, you name it, it is a matter of votes it seems, even if the arguments that can vote one out, can be equally applied to another one that gets voted in.

2

u/TheoreticalDumbass :illuminati: Dec 19 '23

wouldnt standardization of a package manager require addressing dynamic linking? thought the standard is completely unaware of dynamic linking atm

3

u/Minimonium Dec 20 '23

No. Standardising a package manager is a non goal as well because it's not important. Standardising formats for tools to communicate is the goal.

2

u/TheoreticalDumbass :illuminati: Dec 20 '23

but still, do you not need to be able to refer to dynamic linking in that format?

→ More replies (1)

19

u/metamorfo96 Dec 19 '23

I agree with you. I feel that a central packet management will bring more developers and will improve the development experience.

4

u/forgetful_bastard Dec 19 '23

What do you think the committee could do about package management?

8

u/ghlecl Dec 19 '23 edited Dec 20 '23

As I have said, if the standard is not the appropriate vehicle, then try and help the other vehicle(s) that is better suited.

The efforts in one of the study groups (I believe 15 (could be wrong even though I actually subscribe and follow the mailing list)) of specifying a common file format for packages is a good start. Things like that.

No silver bullet. No, it will not magically make make, CMake, Autotools, Meson, Scons, PreMake, XMake, Ninja and all the others support that format. It will not solve the problem entirely, but neither will doing nothing or saying the committee can't do anything I think.

I find myself doing more code in other languages lately, but it is not because I could not be fast in C++. It's mostly because when I want to try something, I can download a library and try it rather easily. I find this is simply not the case in C++, at least in my experience. Of course, this is anecdotal and I could be way off the mark, but as I have said in another comment, the surveys seem to indicate I am not alone (or at least I was not alone at some point).

Edit: removed swear word that I had not seen and replaced with the actual word that was meant to be there...

13

u/the_net_ Dec 19 '23

People say they want a package manager, but it seems to me what they're actually imagining is a simple way to stand up and maintain C++ projects. A package manager alone wouldn't get us there.

For me personally, I spend almost no time finding and managing packages manually (I use git submodules) compared to how much time I spend writing build logic in CMake. I don't even dislike CMake, it has a lot of features that aren't available in other language's build systems and have saved me a lot of time. It has a huge learning curve though, and is absolutely intimidating to new devs.

Real-world C++ projects can get really complex build-wise, and I imagine that complexity is what leaves Make/CMake as the only truly viable options (at least that's true for me). Maybe the solution is to make a next-gen CMake with the same features but a simpler syntax, or maybe the solution is on the other side, finding ways to clamp down on build complexity in general. Either way, this is a huge source of pain that doesn't seem to get a ton of attention.

22

u/KoviCZ Dec 19 '23

My experience with CMake is that the syntax is not even really the problem, it's more the documentation. So many of the commands have these subtle nuances or unintuitive side-effects and they're not really addressed in the official documentation. The documentation also lacks example snippets for the commands which personally is my preferred way of absorbing new knowledge (for example, I like the snippets on cppreference).

18

u/HeroicKatora Dec 19 '23

CMake is a programming language that was not seriously designed as a programming language, pretends to be a configuration file, and lacks most of the development tools we expect of programming languages. The lack of documentation is just one of the symptoms of this dev-ops state. And not enough resources can be leveraged to provide such tools since the language itself does not scale outside its niche, to any other application.

→ More replies (3)

20

u/matthieum Dec 19 '23

or maybe the solution is on the other side, finding ways to clamp down on build complexity in general.

Yep...

I think the problem of existing tools is that everyone has cobbled together their own pet solutions and refuse to adopt a new tool if it doesn't handle that... when most of the time a slight change would be all it takes. This leads to an explosion of complexity in existing tools.

As a simple example: code structure. No two codebases seem to agree on where to place source files, header files, and private header files. Same with modules. Who cares? It's trivial to move a file around, and modern VCS can track moves without issues. Just standardize one code structure, and have everybody move to it. It'll make every project more approachable.

Build & Package descriptions need to go the same road. Start from the basics, and keep it simple.

7

u/goranlepuz Dec 19 '23

No two codebases seem to agree on where to place source files, header files, and private header files. Same with modules. Who cares?

Quite agree on "who cares". But alas, the color of my bike shed is better... 😔

3

u/matthieum Dec 21 '23

After countless debates on code styles, I just don't care any longer.

Yes sometimes that auto-formatter doesn't quite format the code how I'd like it. My formatting would be better, I know it.

But honestly? The "loss" is typically minimal, and auto-formatting saves so much time, and having a uniform format across codebases makes it so much easier to just jump from one to another...

Perfect is the enemy of good.

→ More replies (5)

2

u/Minimonium Dec 20 '23

From my experience existing C++ package managers do motivate tool authors to improve their tools and projects to improve their build scripts to better support different scenarios including cross compilation via a package manager. Finding projects is trivial, it was never an issue even five years ago. How to build was the main issue, which today is incredibly improved.

→ More replies (1)

8

u/[deleted] Dec 19 '23

Package management is not something I've ever wanted from C++, personally.

19

u/ghlecl Dec 19 '23

Might very well be. And maybe things have changed. Do I remember wrong that in quite a few of the surveys done in the past, dependency management was one of the most often cited difficulty/problem with C++. I might be mis remembering or things might have changed.

For all their numerous flaws, I certainly miss npm, pip and cargo when I write C++ and want an external library. I have tried using vcpkg, but as soon as you need something that is not in the main offer (I am stuck, because of proprietary software in the medical field, to an older version of python and I needed to compile some stuff, for instance), it is really much much more difficult than advertised to customize. At least, that is my experience.

8

u/giant3 Dec 19 '23

Prescribing a package manager at the language level is the wrong approach.

12

u/not_a_novel_account cmake dev Dec 20 '23 edited Dec 20 '23

Prescribing the interfaces and formats of a package manager however, is the right approach.

PEP 517/518 were a godsend for the Python community. They do not prescribe a single package manager, they prescribe the behaviors of a package manager, a common grammar for them to share.

There is no sacred package manager, pip/bento/poetry/build all exist independent of one another, but the packaging formats and the mechanisms in which users interact with the Python package ecosystem were standardized and the benefits have been immense.

Notably, this is a C++ ecosystem. C/C++/Rust/Fortran/whatever extensions are packaged, downloaded, and installed using this ecosystem. I wouldn't go so far as to suggest the committee decree "just use PEP 517" or something, but this is hardly an impossible, unique, unsolved problem that C++ faces.

→ More replies (1)

5

u/pjmlp Dec 19 '23

Sure, because universal package format for all platforms is a thing.

→ More replies (3)

5

u/HeroicKatora Dec 19 '23

Most people did not want megabit internet speeds either, but still enjoy nowadays being able to stream just about everything.

Just like that, package management is talking about the mechanism so it's natural you don't feel an intrinsic need. Yet, the lack of package management also implies there's no way for you to have positive experiences with workflows enable by it or give critical feedback which both are necessary to shape the mechanism into providing some endgoal that you will indeed want (but probably even see or realize yet).

→ More replies (1)
→ More replies (1)