obsolete D libraries/modules

Peter Williams pwil3058 at bigpond.net.au
Sat Aug 31 23:40:50 PDT 2013


On 01/09/13 12:29, Jonathan M Davis wrote:
> On Saturday, August 31, 2013 19:18:11 Andrei Alexandrescu wrote:
>> I remember sitting next to Kirk McDonald at the D conference in 2007 as
>> he was showing me Python's argparse. I personally found pretty much any
>> example we could think of more verbose and uglier than std.getopt.
>
> std.getopt is definitely lacking some nice-to-have features (like automatically
> generating --help from the options), but for the most part,

That's the part of argparse that I miss the most.

Also, its support for sub commands is excellent.  I implemented a 
version of quilt in Python and argparse made adding sub commands a 
breeze once the main engine was complete.

I must admit that I toyed with the idea of implementing argparse in D 
myself but rejected the idea when I realised that hard typing in D would 
make it a non trivial exercise.

But I still think the basic ideas (i.e. integrated documentation, 
specifying how many no option arguments there can be and support for sub 
commands) are good.  I especially like the integrated documentation as 
it makes code maintenance much easier when everything about an 
option/argument is in the one place.

Peter
PS before argparse I used to use getopt (C and Python) and I still 
haven't decided whether I like D's version better than the originals 
(probably yes for C and no for Python).



More information about the Digitalmars-d mailing list