digitalmars.D.bugs - [Issue 20819] New: std.getopt should detect duplicated pointers
- d-bugmail puremagic.com (31/31) May 10 2020 https://issues.dlang.org/show_bug.cgi?id=20819
https://issues.dlang.org/show_bug.cgi?id=20819 Issue ID: 20819 Summary: std.getopt should detect duplicated pointers passed as arguments. Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: witold.baryluk+d gmail.com import std.getop; auto optparser = getopt( args, std.getopt.config.passThrough, std.getopt.config.caseSensitive, ...., "iterations_min", "A iterations minimum (default: " ~ to!string(iterations_min) ~ ")", &iterations_min, "iterations_max", "A iterations maximum (default: " ~ to!string(iterations_max) ~ ")", &iterations_min, ); Spot the error. It should be detected by the getopt automatically and throw an exception without even checking the 'args'. I really doubt there is a valid use case to have duplicated pointers, and if there is (i.e. renaming flags and deprecating but supporting old one), it can be enabled using std.getopt.config flag. --
May 10 2020