getopt: How does arraySep work?

Steven Schveighoffer schveiguy at
Thu Jul 16 17:40:25 UTC 2020

On 7/16/20 1:13 PM, Andre Pany wrote:
> On Thursday, 16 July 2020 at 05:03:36 UTC, Jon Degenhardt wrote:
>> On Wednesday, 15 July 2020 at 07:12:35 UTC, Andre Pany wrote:
>>> [...]
>> An enhancement is likely to hit some corner-cases involving list 
>> termination requiring choices that are not fully generic. Any time a 
>> legal list value looks like a legal option. Perhaps the most important 
>> case is single digit numeric options like '-1', '-2'. These are legal 
>> short form options, and there are programs that use them. They are 
>> also somewhat common numeric values to include in command lines inputs.
>> [...]
> My naive implementation would be that any dash would stop the list of 
> multiple values. If you want to have a value containing a space or a 
> dash, you enclose it with double quotes in the terminal.

Enclose with double quotes in the terminal does nothing:

myapp --modelicalibs "" ""

will give you EXACTLY the same string[] args as:

myapp --modelicalibs

I think Jon's point is that it's difficult to distinguish where an array 
list ends if you get the parameters as separate items.


myapp --numbers 1 2 3 -5 -6

Is that numbers=> [1, 2, 3, -5, -6]

or is it numbers=> [1, 2, 3], 5 => true, 6 => true

This is probably why the code doesn't support that.


More information about the Digitalmars-d-learn mailing list