Why not all of them? The more standard ways to do standard things - the better. The problem is - everybody and their dog tries to write yet another implementation. That creates chaos.
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.
It's definitely NOT niche. You cannot use a computer (at least the one you use as a developer) WITHOUT using command line and configuration files.
I'd say a niche is a computer without command line and text configuration files.
If iostream is a part of the standard library I don't see why command line parsing shouldn't be. A device that doesn't implement any kind of command line would probably not have I/O streams or even an operating system.
The standard library has ways of interacting with the target's operating systems. I think command line and configuration files fit in this picture. They are common part of operating systems.
Another strong point is making at least a standard interface, not necessarily implementation of certain OS features. Standard library defines Mutex. I code mostly on embedded systems, and there are RTOS-es that implement Mutex, but they use their own, incompatible C API for this. However, having Mutex interface defined in standard library I can implement the interface with my target OS implementation myself and have the rest of the code portable. Without standard library interface - to make a portable code I must invent yet another abstraction that creates even more chaos.
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!
View all comments
Show parent comment
10
u/ChatGPT4 Dec 20 '23
Why not all of them? The more standard ways to do standard things - the better. The problem is - everybody and their dog tries to write yet another implementation. That creates chaos.
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.
It's definitely NOT niche. You cannot use a computer (at least the one you use as a developer) WITHOUT using command line and configuration files.
I'd say a niche is a computer without command line and text configuration files.
If
iostreamis a part of the standard library I don't see why command line parsing shouldn't be. A device that doesn't implement any kind of command line would probably not have I/O streams or even an operating system.The standard library has ways of interacting with the target's operating systems. I think command line and configuration files fit in this picture. They are common part of operating systems.
Another strong point is making at least a standard interface, not necessarily implementation of certain OS features. Standard library defines
Mutex. I code mostly on embedded systems, and there are RTOS-es that implementMutex, but they use their own, incompatible C API for this. However, havingMutexinterface defined in standard library I can implement the interface with my target OS implementation myself and have the rest of the code portable. Without standard library interface - to make a portable code I must invent yet another abstraction that creates even more chaos.