New library: argparse, for parsing CLI arguments
Steven Schveighoffer
schveiguy at gmail.com
Thu Oct 14 15:11:41 UTC 2021
On 10/13/21 9:13 PM, Andrey Zherikov wrote:
> On Thursday, 14 October 2021 at 00:35:11 UTC, Bill Baxter wrote:
>>
>> Not sure how much change there is over "classic" gflags, but
>> https://abseil.io/docs/cpp/guides/flags is what google now uses
>> internally.
>>
>
> Abseil version suggests not to put flags into multiple .cpp files:
> - `Allows distributed declaration and definition of flags, though this
> usage has drawbacks and should generally be avoided`
> - `Prefer to define flags only in the file containing the binary’s
> main() function`
> - `Prefer to reference flags only from within the file containing the
> binary’s main() function`
>
> So I'm a bit confused about supporting this use case
Yeah, there is a problem with doing this the D way, and that's with
module constructors. You can run into cycles.
When I implemented database migrations in my application, I set it up so
I could run module ctors that set up each migration near the location
where I'm defining the data structures, but I ended up having to put
them all into a dedicated `migrations` module to avoid the cycles.
D could definitely use a way to specify a no-dependency module ctor/dtor.
-Steve
More information about the Digitalmars-d-announce
mailing list