getopt: How does arraySep work?

Andre Pany andre at
Tue Jul 14 11:12:06 UTC 2020


by reading the documentation of std.getopt I would assume, this 
is a valid call

dmd -run sample.d --modelicalibs a b

``` d
import std;

void main(string[] args)
     string[] modelicaLibs;
     getopt(args, "modelicalibs", &modelicaLibs);
     assert(modelicaLibs == ["a", "b"]);

but it fails, as array modelicaLIbs only contains ["a"].

The std.getopt : arraySep documentation hints that it should work:
> The string used to separate the elements of an array or 
> associative array (default is "" which means the elements are 
> separated by whitespace).

Is my understanding wrong, or is this a bug?

Kind regards

More information about the Digitalmars-d-learn mailing list