obsolete D libraries/modules

Ramon spam at thanks.no
Sun Sep 1 11:10:30 PDT 2013


On Sunday, 1 September 2013 at 17:20:56 UTC, Jacob Carlborg wrote:
> On 2013-09-01 16:28, Andrei Alexandrescu wrote:
>
>>> string outputFile;
>>> getopt(args, "output", 
>>> &outputFile).min(2).max(4).restrict("a", "b",
>>> "c", "d");
>>
>> What would this line do?
>
> The "output" argument expects at least two values and at most 
> four. The values can be "a", "b", "c" or "d".

Conceptionally questionable. The job of an argument parser is to
parse arguments, to possibly do some comfort magic (like
generating arg help) and to return info about the arguments in a
sensible manner.

It is *not* to do things that are not general but rather the
programms job.

And it is based on well established standards like having args in
either short form '-' (or '/' on windoze) plus one letter or in
long form '--' plus optionname and letting options have optional
arguments as in '-o outfile'.

Unless we want to arbitrarily (and therefore often uselessly)
pick out one of the many multi option argument notations like "-x
a:b=3:c=8859-15" it is - and should be - the task of the programm.

phobos job shouldn't be to provide comfort and magic for any and
every no matter how abstruse situation but to offer concise,
clear, well defined and real world mechanisms.

Considering that a standard lib is rather close to (and by many
considered part of) the language, there are, as in language
design, many trade offs to be decided upon, generality and
reliability weighing in much higher than "it can do everything
including the kitchen sink and a colour picker".


More information about the Digitalmars-d mailing list