www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20480] New: make std.getopt ready for DIP 1000


          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 puremagic.com
          Reporter: ag0aep6g 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.

Jan 04 2020