std.getopt suggestion

Nick Sabalausky a at a.a
Sat Oct 1 10:56:57 PDT 2011


"Andrei Alexandrescu" <SeeWebsiteForEmail at erdani.org> wrote in message 
news:j679o0$1hdm$1 at digitalmars.com...
> On 10/1/11 5:42 AM, Jacob Carlborg wrote:
>>
>> I forgot to mention that I don't want the order of the arguments to
>> matter. I should be possible to write:
>>
>> "foo bar -b -a"
>>
>> Or at least it should be possible to put global options anywhere in the
>> command line.
>>
>> So I guess that would be using the passThrough option the first time
>> getopt is called and then using the noPassThrough option when it's
>> called the second time from the action implementation.
>>
>> So there we have a use case for calling getopt more than once, at least
>> I have a use case for that.
>
> Clearly there are legit use cases. The use of monostate does not impede 
> them.
>

It makes them error-prone whenever you want to use a different option.

The use of Jon's suggestion does not impede the single-use cases. But it 
does make the other cases less problematic. So there's benefit with no 
downside.




More information about the Digitalmars-d mailing list