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
[vcpkg] Rewriting CmdLineBuilder/Command (3/n) #15673
Conversation
d426bef
to
383050f
Compare
383050f
to
fbf777c
Compare
explicit Command(const std::string& s) { string_arg(s); } | ||
explicit Command(const char* s) { string_arg({s, ::strlen(s)}); } | ||
|
||
Command& path_arg(const fs::path& p) & { return string_arg(fs::u8string(p)); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit unhappy with the combination of the "data" name plus "data" named functions; specifically, it is not clear from the name of the type nor the name of the functions that these are mutating functions -- you need to either notice that the return type is &
or read the implementation to know that these will mutate the existing object.
This is why I named the original type "Builder": so that the functions like path_arg
could be short instead of append_path_arg()
yet there was still nomenclature to note that these functions are mutating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also generally don't see sufficient motivation for change in the name, this just introduces code churn for insufficient gain IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree; it's fundamentally no longer a "builder", it's "the thing itself".
Also, I would argue that this kind of naming for functions makes sense; see Rust's Command type, which does the same thing.
Rename CmdLineBuilder to Command, since it's no longer a builder but an actual data type
fbf777c
to
4359ab7
Compare
Rename CmdLineBuilder to Command, since it's no longer a builder but an actual data type
Rename CmdLineBuilder to Command, since it's no longer a builder but an actual data type.
This is the 3rd PR in the "rewrite CmdLineBuilder" saga; at this point, we need a new type name :)