digitalmars.D.bugs - [Issue 1802] New: std.getopt.getopt returns bool; should be void
- d-bugmail puremagic.com (26/26) Jan 23 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1802
- d-bugmail puremagic.com (9/9) Jan 25 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1802
- d-bugmail puremagic.com (7/7) Jan 25 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1802
- d-bugmail puremagic.com (9/9) Mar 06 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1802
- d-bugmail puremagic.com (7/7) Mar 06 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1802
- d-bugmail puremagic.com (7/7) Mar 06 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1802
http://d.puremagic.com/issues/show_bug.cgi?id=1802 Summary: std.getopt.getopt returns bool; should be void Product: D Version: 2.010 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: bugzilla digitalmars.com ReportedBy: caron800 googlemail.com D's error handling policy, as documented at http://digitalmars.com/d/2.0/errors.html, says that functions should throw exceptions on error, not return a pass/fail code. However, getopt throws no exception on error, but instead returns true for success and false for failure. This means that calling code must do lots of ugly checking of the return code. Further, if it returns false, there is no way to find out why it failed, wheras an exception could carry that information. To make matters worse, the meaning of the bool return value is not documented! So the only way to find out that you even /need/ to do error checking is to read the source code (which is, by definition, an implementation detail, not the API). getopt should return void. In the event of an error, an exception should be thrown. --
Jan 23 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1802 andrei metalanguage.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Duly noted. I'll change the signature as requested, and will roll the change in the next minor release. --
Jan 25 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1802 andrei metalanguage.com changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|bugzilla digitalmars.com |andrei metalanguage.com Status|ASSIGNED |NEW --
Jan 25 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1802 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Fixed dmd 2.012 --
Mar 06 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1802 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED | --
Mar 06 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1802 andrei metalanguage.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED --
Mar 06 2008