Command line parsing

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Sun May 15 11:36:48 PDT 2016


On Monday, 2 May 2016 at 12:52:42 UTC, Andrei Alexandrescu wrote:
> This is interesting because it's what std.getopt does but the 
> opposite of what GFLAGS (http://gflags.github.io/gflags/) does. 
> GFLAGS allows any module in a project to define flags. I was 
> thinking of adding GFLAGS-like capabilities to std.getopt but 
> looks like there's no need to... thoughts?
>

LLVM uses a gflags like system. That way, any pass can add its 
own configuration flag and it all works. On the other hand, it 
makes it impossible to have the same pass with different config 
and is a pain in the ass if not used from C/C++ .

If I can see some projects benefiting from a GFlags like 
approach, I don't think it should be promoted by the standard 
lib. It only works well if all the code is writen to cooperate in 
a sensible way. This is good if you have end to end control, but 
really bad in the general case.



More information about the Digitalmars-d mailing list