Proposal: fix for getOpt (missing feature)

Malcolm Wallace Malcolm.Wallace at
Tue Jun 26 03:58:06 EDT 2007

> > Currently, long option names _must_ have two dashes (e.g. --foo),
> > whereas this patch permits a single dash (e.g. -foo) where there is no
> > short option name to be confused with it (e.g. -f).

> Are, you sure this is a good idea?  What if options are passed  
> through, or the -f option is later added?  Then users have to change  
> there scripts, maxefiles, etc. that use these options.  I don't think  
> this scales well.

It is the behaviour of GNU GetOpt, which is very widely used and
understood.  The proposal is merely that the Haskell implementation
should match the de facto standard in this area.  (It even originally
contained a comment stating that it was deficient here!)

I believe there are a large number of people who use unix-style
commandlines who would expect this behaviour.

> I think the program user should be encouraged to use two dashes for the
> 'foo' option, in order to allow the programmer to add options -f and -o
> later without the risk of breaking existing scripts.

Sure, and all the usage + error messages generated by GetOpt mention
only the two-dash form, as a way of encouraging forward compatibility.


More information about the Libraries mailing list