std.getopt suggestion

Jose Armando Garcia jsancio at gmail.com
Fri Sep 30 10:39:23 PDT 2011


On Wed, Sep 28, 2011 at 12:44 PM, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> So, my suggestion is that we create a GetOpt struct which contains all of the
> options for getopt, and we make getopt a member function of that struct.

Making it a struct gives you a design flexibility that really is an
illusion. Most people it not all people use getopt to parse command
line param. Giving the user the flexibility to have multiple GetOpt
with different configuration when in essence they are parsing the same
share resource (the command line) is incorrect.

I prefer if we take std.getopt one step further (or create another)
and make it completely global. Don't allow the parsing of anything but
the command line and make the results of the parsing available as
immutable to all the threads in the process. We can even extends
getopt to also look at environment variables.


More information about the Digitalmars-d mailing list