[ ghc-Bugs-687034 ] GetOpt overly ambiguous

Sven Panne Sven.Panne@informatik.uni-muenchen.de
Tue, 18 Feb 2003 22:06:05 +0100


[ Redirected to libraries list, because it is probably the right place
   to discuss System.Console.GetOpt ]

Will Partain wrote:
 > [...] While you're thinking about it, you might want to clarify the
 > behavior of GetOpt in a few weird cases, e.g.
 >
 > * duplicates of no-arg options are OK; e.g.: --foo --foo
 >
 > * duplicates of with-arg options is bogus; e.g.:
 >   --foo-file=/etc/foo --foo-file=/etc/bar
 >
 >   (but what about? --foo-file=/etc/foo --foo-file=/etc/foo)
 >
 > and others you can no doubt think of easily.

Hmmm, I'm not sure if there is a one-size-fits-all solution for this,
e.g. think about a -v no-arg option, where one -v means "verbose", two
-v mean "very verbose", three -v mean "ridiculously verbose" etc.
Even for with-arg options an accumulating behaviour can make
sense, e.g. for specifying multiple input files.

What do other people think about this issue? Should the handling of
these cases be left to the application or should we take some special
measures in the library itself?

Cheers,
    S.