Jump to page: 1 2
Thread overview
dmd command line options bad design: -offilename, -Ddocdir etc.
Apr 10, 2013
Timothee Cour
Apr 10, 2013
Walter Bright
Apr 11, 2013
Jacob Carlborg
Apr 11, 2013
Jonas Drewsen
Apr 11, 2013
Andrej Mitrovic
Apr 11, 2013
Jonas Drewsen
Apr 11, 2013
Andrej Mitrovic
Apr 11, 2013
John Colvin
Apr 11, 2013
Paulo Pinto
Apr 12, 2013
Timothee Cour
Apr 12, 2013
Iain Buclaw
Apr 12, 2013
John Colvin
Apr 12, 2013
Paulo Pinto
Apr 12, 2013
Paulo Pinto
Apr 12, 2013
John Colvin
Apr 12, 2013
Paulo Pinto
Apr 12, 2013
Andrej Mitrovic
Apr 12, 2013
Kagamin
Apr 12, 2013
Andrej Mitrovic
Apr 11, 2013
Jacob Carlborg
April 10, 2013
Couldn't find a post on this so I'm asking here:
is there any reason why dmd chose to use this flag naming convention
in the first place?

-Dddocdir
-Dffilename
-Ipath
-offilename
(etc...)

vs a sane way, eg the one used in ldc2 (or many other unix tools, which have a space at least as delimiter):

-Dd=docdir
-Df=filename
-I=path
-of=filename

The problem is:
* dmd's flags don't scale: now we can't have any new flag starting
with "-I" or "-L", etc as it would create conflicts. And I know some
people want to keep the number of flags to a minimum but that's not a
good reason to restrict future expansion ability
* it's visually harder to tell from the command line the options from
the arguments to these options.

If we don't deprecate in favor of the ldc2 style (is that an option with a proper deprecation path?), can we at least make sure any future flags will follow ldc2's convention?
April 10, 2013
On 4/10/2013 11:20 AM, Timothee Cour wrote:
> Couldn't find a post on this so I'm asking here:
> is there any reason why dmd chose to use this flag naming convention
> in the first place?
> [...]

I agree. The way to do it is to support both the old and the new ways for now. Anyone want to do a pull req? Also, this should be put in bugzilla as an enhancement request.
April 11, 2013
On 2013-04-10 21:30, Walter Bright wrote:

> I agree. The way to do it is to support both the old and the new ways
> for now. Anyone want to do a pull req? Also, this should be put in
> bugzilla as an enhancement request.

Preferably the code for the new syntax should be in its own module/function and not included directly in "main".

-- 
/Jacob Carlborg
April 11, 2013
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.

/Jonas
April 11, 2013
On 4/11/13, Jonas Drewsen <nospam4321@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.

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.
April 11, 2013
On Thursday, 11 April 2013 at 11:16:08 UTC, Andrej Mitrovic wrote:
> On 4/11/13, Jonas Drewsen <nospam4321@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

April 11, 2013
On 2013-04-11 12:25, Jonas Drewsen 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.

For some reason compilers seem to only use a single dash for all formats. That is true for DMD, GCC and Clang.

-- 
/Jacob Carlborg
April 11, 2013
On 4/11/13, Jonas Drewsen <nospam4321@hotmail.com> wrote:
> 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.

Unix != universal standard.
April 11, 2013
On Thursday, 11 April 2013 at 15:15:09 UTC, Andrej Mitrovic wrote:
> On 4/11/13, Jonas Drewsen <nospam4321@hotmail.com> wrote:
>> 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.
>
> Unix != universal standard.

Next best thing.
April 11, 2013
Am 11.04.2013 17:20, schrieb John Colvin:
> On Thursday, 11 April 2013 at 15:15:09 UTC, Andrej Mitrovic wrote:
>> On 4/11/13, Jonas Drewsen <nospam4321@hotmail.com> wrote:
>>> 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.
>>
>> Unix != universal standard.
>
> Next best thing.

Actually I would like to know how the desktop world would look like
had Apple bought BeOS instead.

This would mean no UNIX on the desktop, assuming Apple would have
won a similar market as of today.

--
Paulo
« First   ‹ Prev
1 2