[Mono-dev] Program Option Parsing Library

Jonathan Pryor jonpryor at vt.edu
Fri Jan 11 06:16:04 EST 2008

On Thu, 2008-01-10 at 14:46 -0800, Jay Logue wrote:
> Jonathan Pryor wrote:
> > As for what Getopt::Long does...  "--foo --bar" sets "--bar" as the
> > value of the --foo argument.  "--bar --foo" (i.e. no argument for --foo)
> > generates the output:
> >
> > 	Option foo requires an argument
> >
> > I'm conflicted as to which is the better behavior.
> Yeah, that's a tough one.  I probably lean towards the Getopt behavior 
> as its easier to explain, e.g. "if --foo takes a value, then whatever 
> comes after it will be treated as a value, regardless of what it looks 
> like".

I'm not fond of the Getopt behavior, though it's behavior has never
bitten me.  On the plus side, the Getopt behavior is easier to implement
-- it cuts Options.Parse() down to 78 lines from 96 lines.

Score one for consistency...

 - Jon

More information about the Mono-devel-list mailing list