dmd command line options bad design: -offilename, -Ddocdir etc.

Jonas Drewsen nospam4321 at hotmail.com
Thu Apr 11 05:12:56 PDT 2013


On Thursday, 11 April 2013 at 11:16:08 UTC, Andrej Mitrovic wrote:
> On 4/11/13, Jonas Drewsen <nospam4321 at hotmail.com> wrote:
>> AFAIK most unix tools have two formats: long and short.
>>
>> long:
>> dmd --foobar-dir=/somewhere/over/the/rainbow
>>
>> short:
>> dmd -f /somewhere/over/the/rainbow
>>
>> Most programs supports both. I think that would be the way to 
>> go.
>
> RDMD works on the assumption that its flags begin with -- and 
> DMD's
> flags with -. There's no need to invent new short/long 
> switches, we
> just need an equals sign to make it visually clear.

By "I think that would be the way to go" I did not necessary 
refer to having both formats supported at the same time but 
simply to use the standard way that people know.

> Also using spaces might be a bad idea, you might end up doing 
> the
> wrong thing if you call DMD incorrectly (e.g. a result of a 
> wrong
> expansion in a shell script), for example:
>
> $ dmd -of foo.d bar.d
>
> Currently this is an error, the user forgot to specify the -of 
> switch.
> If spaces were ok then this becomes the equivalent of:
>
> $ dmd -offoo.d bar.d
>
> I'd rather be safe than sorry and allow either -offoo or 
> -of=foo. It
> will catch errors this way rather than do something unexpected.

You may not like using spaces but it is a widespread standard and 
I think deviating is not the way to go. Anyway - this is turning 
into a bikeshed coloring discussion I guess :)

/Jonas



More information about the Digitalmars-d mailing list