catchorg / Clara

A simple to use, composable, command line parser for C++ 11 and beyond
Boost Software License 1.0
649 stars 67 forks source link

[Discussion] Why another command line parser? #15

Closed rcdailey closed 8 years ago

rcdailey commented 8 years ago

Why would I use this as opposed to: http://www.boost.org/doc/libs/1_60_0/doc/html/program_options.html

Note that windows syntax for command line options is kinda silly; anything that is platform-agnostic uses - and -- notations. I'm not sure if Boost Program Options lets you change this syntax, but I never use anything but it.

Maybe your documentation can explain why we need another parser for this, kind of like you do for Catch.

philsquared commented 8 years ago

A good question ("why would I use this"). I don't have a complete story there yet. I haven't yet committed to this library as a first class project - hence the 0.0 versioning and lack of documentation. It's still in the "move fast and break things stage". Personally I find it much easier to use that boost PO (and, in fact, I ripped out a few PO usages in my work codebase and replaced them with Clara - which made it much more readable to my eye). I'm not the best judge of that, though, as I wrote it to my tastes and am much more familiar with it. However others have said the same thing (even with the lack of docs!) so there might be something in it. It also has the same properties of being header-only and no dependencies (beyond the C++03 stdlib).

Finally it is potentially safer as all values are converted to target types up-front and in one place - so incorrect input is dealt with my the library - by the time you get it it's already correctly typed.

philsquared commented 8 years ago

Oh, and as for the windows forward slashes: Forward slashes are the default on windows. '-' still works - so it doesn't matter which you use. It wasn't essential but a nice to have that has been requested from time-to-time.

rcdailey commented 8 years ago

I can understand the need for it, since you can't really introduce non-standard dependencies in Catch (it would eliminate the "header only" convenience it offers). From that respect this seems like a submodule dependency of Catch, rather than an intentionally independent library.

philsquared commented 8 years ago

well it used to be part of Catch but I spun it out (a) because I wanted to use it elsewhere and (b) because speaking to others there was some interest in it.

GatoRat commented 8 years ago

For me, the answer is simple--Boost is a bloated, out-dated library desperately in need of being rebased to C++14.

refi64 commented 8 years ago

Well, I wouldn't call Boost out-of-date, but it's definitely hard to separate parts of it out without bringing the kitchen sing with it.

rcdailey commented 8 years ago

Without boost, we wouldn't have many of the nice facilities we have in STL today. Many parts of boost are still around to support C++03 code bases. I argue those parts are no longer useful in C++11 and up. It's not out of date at all. I still use many parts of boost because those pieces are not in stl yet, like filesystem.

It always amuses me how people blindly speak against boost. Sure it isn't the smallest library and not all parts of boost are likeable, but what boost represents is invaluable to the language.

GatoRat commented 8 years ago

It is interesting to observe how superior the standard library implementations of boost features are over boost itself.

You can argue all you want about how Boost is not out of date, but it blatantly is and the longer they go without rebasing to C++14, the worse it's going to get.

"It always amuses me how people blindly speak against boost."

It always amuses me how defenders of boost blindly support it without any critical analysis and fail to see the problems it causes, which are legion. My antipathy toward boost is the result of using it in several projects and running into so many problems, eventually removing it in all but one (though the chief architect on that project told me that using Boost was a mistake.)

refi64 commented 8 years ago

I don't know, Boost.Spirit and Boost.Filesystem are pretty nice, especially since few compilers have implemented the filesystem TS.

rcdailey commented 8 years ago

GatoRat, my intent for creating this issue was not to discuss your religious feelings towards the Boost library. Honestly your feelings on the library do not matter to me one bit. If you don't like it, that's fine, but share that opinion elsewhere.

I am not advocating that Catch use boost. I am merely using Boost Program Options as an example of an existing solution to roughly the same problem that Clara solves.

Phil has done a good job explaining the reason for it, which I agree with, so I will close this issue. Thanks to phil for explaining.