[Issue 20480] New: make std.getopt ready for DIP 1000

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 5 00:26:29 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=20480

          Issue ID: 20480
           Summary: make std.getopt ready for DIP 1000
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: ag0aep6g at gmail.com

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.

--


More information about the Digitalmars-d-bugs mailing list