Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make uniform add_param / add_params #49

Open
richoux opened this issue Dec 18, 2019 · 1 comment
Open

Make uniform add_param / add_params #49

richoux opened this issue Dec 18, 2019 · 1 comment

Comments

@richoux
Copy link

richoux commented Dec 18, 2019

add_param takes a std::string as an input, and add_params a std::initializer_list<char const* const>.

However it is easy to forget the final 's' or add an extra 's', and not realizing where the error comes from even after carefully reading the compilation error message. A missing/extra 's' is something easy to skip while reading the error message.

Why not having add_param and add_params taking both kind of parameters, or removing one function? The latter is certainly clearner but will brake some projects using the deleted function.

@adishavit
Copy link
Owner

I see what you mean.
I don't want to break existing code and I think the current API - with both functions - allows for better readability.

Why don't we just add a std::string overload to add_params() and make add_param() just fwd the call to add_params?

Please make a PR.

TerenceJefferies added a commit to TerenceJefferies/argh that referenced this issue Oct 6, 2022
Reference: adishavit#49

For ease-of-use, make the add_param method and the add_params method interchangeable. Allowing either to be called with multiple or single parameters.

Each of the newly created methods simply calls the original version, preventing the need for wide-spread changes in the future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants