4 ms·
This defeats the purpose of a good flags library though. Where flags shine is when you've some obscure tunable deep in the dependency tree that you need to twe
by bbrazil 10y ago
This defeats the purpose of a good flags library though.
Where flags shine is when you've some obscure tunable deep in the dependency tree that you need to tweak (particularly in an emergency). Plumbing through potentially thousands of flags through to main is nonsensical in that scenario.
- dlor 10y agoThe flag libraries I've used always make this easy, but the problem comes in when you try to reuse that dependency in another binary as a library. Maybe you've seen a better flags library than I have, though.
- bbrazil 10y agoNo, the flags libraries I've used had exactly that issue. When that came up what you'd do then is refactor that to be a class parameter or config option or whatever (and we'd usually ask that the flag be kept in some form). Until then though you get the benefits of a quick and easy way to both expose and use tunables, which is much better than not having it at all.
- MereInterest 10y agoWhich works great, until you want to modify that parameter on the fly, or adjust it based on the current load of the system. Then you're sink, because you had that tunable parameter read from some global state, instead of being set from its parent.