On 5/14/16 10:44 AM, Russel Winder via Digitalmars-d wrote:
On Sat, 2016-05-14 at 07:34 +0300, Andrei Alexandrescu via Digitalmars-
d wrote:
  […]
What are those and how are they better? -- Andrei

C: argp, GNOME CLP
C++ Clara, gtkmm CLP
Python: argparse
Groovy: Commons CLI wrapper
…

the list is quite lengthy.

I showed a fellow programmer std.getopt. We were both on laptops. He wanted to show me how good Python's argparse is and how D should copy it. By the end of the chat it was obvious argparse was much more verbose and less pleasant to use than getopt. Like you have to create an object (?!?!) to parse the command line and many other lines of nonsense.

A table of data declaring all the things. No messing round with control
flow during the parse. Automated message construction. Use of
properties and data structure for all the results.

Where is the control flow in

bool frob, meh;
getopt(args,
  "frob", "This is the frob", &frob,
  "meh", "That's the meh", &meh);

? Honest question.

Basically an increased level of abstraction. Imperative → Declarative.

I'm not seeing the imperative here. Care for a concrete side-by-side comparison? Pick your cherries.


Andrei

Reply via email to