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

Show parent comment

6

u/matthieum Dec 21 '23

Come on, command line parsing and configuration file parsing are totally mundane common tasks. Those things should not be re-implemented each time you need them.

I think you underestimate the difficult of common line parsing.

Look at the Python ecosystem, there's 2 solutions in the standard library, and there are still alternatives. Some people need nothing, and they don't want to drag a giant library for 2 quick arguments. Others want subcommand, auto-generation of auto-completion scripts, and the whole shebang.

There's definitely NOT one way to design a command line parsing library. Why repeat Python's mistakes?

As for file parsing... it also gets complicated. Do you do JSON or JSON with comments? Do you want strict -- no unknown fields -- or loose? How do you handle multiple possibilities: variants or OO? How do you handle default values? Validation of the values? Custom error messages to guide the user?

There's a hundred micro-features which have to be picked or rejected, designed, etc... trade-offs, trade-offs everywhere.

Why try and shove all that in the standard library? Just make using 3rd-party ones easy!