re: #16545 (review)
Marco if you look at my PR list, a half decade PR is fresh and new. But seriously, I think the reason this PR has been open so long is one reviewer gave a lot of pushback, and other potential reviewers were scared off, and I was previously very slow to update this and respond to comments. Given the previous state of the PR, even if other reviewers were interested in it, and wanted to help, and would agree with the PR’s approach after looking into it, it’s extremely unlikely any new reviewer would be invested enough in this topic to want read the long threads here and wade into an ongoing debate.
As of last week though, I made major improvements to the PR adding a detailed documentation commit explaining the design of the API, and a new test commit that demonstrates features of the API and how they can realistically be used. The new tests are much different with than previous tests which exhaustively verified correctness of the implementation but did not try to show real use cases. So I’m ready to reengage on this PR and related issues #22978, #17508, #30529, #17783, #17581, #17580, #17493,
To get to your specific concerns and suggestions, I understand why the approach you are suggesting seems appealing conceptually, but I think if you look at the details it will either (1) bake footguns and misfeatures into the API which will be harder to get rid in the long run or (2) result in a series of changes which cause unnecessary pain for users and also be unnecessarily confusing to developers.
The appealing thing about your approach is it can let us apply type flags in bulk, and be assured that the flags will only restrict what settings values are allowed, without changing the way any setting value is interpreted once allowed. The problem with this approach is that the way a lot of current settings are interpreted is broken and crazy so I think it would be a mistake to introduce typed settings and either bake in bad design and behavior permanently, or force ourselves to need sweeping changes instead of targeted changes to fix bad behavior in the future.
I think a better approach is to introduce flags which are internally coherent and actually support features we know we will use, and then roll the flags slowly, to one setting at a time, changing behavior of each setting once rather than multiple times, and documenting changes explicitly. I think this is a better approach because it will allow us to iterate and provide the best API for developers and best configuration interface for users in each specific case, and also provide the least confusing experience for upgrading and reasoning about backwards compatibility, because changes will be described concretely in terms of individual settings rather than abstractly about settings in bulk.
Two more things:
-
On -noconnect and -nolisten, I don’t think we have any disagreement and I don’t think anything in this PR adds any footguns or gets in the way of anything you would want to do. If you look at the new ExampleOptions
test here, there is even a -nolisten
setting implemented with these flags, and I think it looks pretty good but you can let me know if you disagree. Again though, please be aware there are two separate parts to this change because the flags control both (1) validation behavior and (2) behavior of the GetArg convenience functions. If there are disagreements about validation behavior, we should sort those out because there are are limited number of flags we should add and it may be difficult to change meaning of existing flags. But I do not think we should spend too much time disagreeing about behavior of GetArg convenience functions because they are just wrappers around GetSetting(). So if we find a situation where GetArg functions do not work well, or you want a different behavior, they are relatively easy to change or work around by introducing a new convenience function for your use-case.
-
If you don’t like ALLOW_BOOL | ALLOW_STRING
and think std::variant<bool, string>
or std::variant<Disabled, std::string>
would be better, I’m working on a change to implement that in #22978 (comment). Right now that change is implemented on top of this PR, but it could be implemented as a replacement for this PR so ALLOW_ flags don’t even need to exist. The nice thing about this PR being so old is that now we have C++20, so that change is much easier than implement than it would have been previously.