DIP 1000 should enable @safe usage of std.getopt. For example, this should work when compiled with `-preview=dip1000`:
----
void main() @safe
{
import std.getopt;
string[] args = ["test", "--foo", "42", "--bar", "BAR"];
int foo;
string bar;
getopt(args, "foo", &foo, "bar", "bar help", &bar);
assert(foo == 42);
assert(bar == "BAR");
}
----
It currently throws errors about getopt's parameters being non-scope.
Looks light it might be a quick fix. PR incoming.
Comment #1 by dlang-bot — 2020-01-05T00:33:24Z
@aG0aep6G created dlang/phobos pull request #7344 "fix issue 20480 - make std.getopt ready for DIP 1000" fixing this issue:
- fix issue 20480 - make std.getopt ready for DIP 1000
https://github.com/dlang/phobos/pull/7344
Comment #2 by dlang-bot — 2020-01-05T01:43:09Z
dlang/phobos pull request #7344 "fix issue 20480 - make std.getopt ready for DIP 1000" was merged into master:
- 36ca83737ab295c4fcbd3ffbaee11059dee468af by aG0aep6G:
fix issue 20480 - make std.getopt ready for DIP 1000
https://github.com/dlang/phobos/pull/7344