Conversation
| CommandLineOptions const& options() const { return m_options; } | ||
|
|
||
| /// yields CLI option names (without leading "--") that require --experimental. | ||
| static std::vector<std::string> const& experimentalOptionNames(); |
There was a problem hiding this comment.
i was itching to make this a static std::array constexpr but that would've been a bigger refactor and entailed making all the global static strings in the implementation file g_str* string views or similar and update the various string concatenations in the cli to fmt::format style. didn't seem worth the effort in the end.
There was a problem hiding this comment.
You mean you'd replace them with global static string_views? Don't they still need to be attached to some string stored somewhere? What would that look like?
TBH I have mixed feelings about those global strings. I kept them back when I refactored the CLI, but they're clunky, not used consistently for all options and I'm not sure this really saves us all that much. The biggest benefit is I guess preventing typos when you have to use an existing option name in a bunch more places, but that's not much.
There was a problem hiding this comment.
You mean you'd replace them with global static
string_views? Don't they still need to be attached to some string stored somewhere? What would that look like?
If you write static std::string_view constexpr v{"hi"} then that string literal in there already has static storage duration and so the string view can just point to that - they have constexpr support :)
So something like this works, too:
static auto constexpr opts = std::to_array<std::string_view>({
"A", "B", "C"
});TBH I have mixed feelings about those global strings.
Not the biggest fan of them, either. I agree, they have dubious value here... I'd be much happier with a struct that defines the properties of an option somewhere and having a couple of these.
61013c6 to
c2e935c
Compare
1c491c2 to
73cfbfe
Compare
73cfbfe to
bb64ae4
Compare
Also exposes the set of experimental options from cli so we don't have to maintain it in multiple places.
See #16503 (comment)