Program logic bugs vs input/environmental errors
Joseph Rushton Wakeling via Digitalmars-d
digitalmars-d at puremagic.com
Mon Sep 29 08:39:06 PDT 2014
On Monday, 29 September 2014 at 00:47:58 UTC, Walter Bright wrote:
> On 9/28/2014 4:18 PM, Joseph Rushton Wakeling via Digitalmars-d
> wrote:
>> I don't follow this point. How can this approach work with
>> programs that are
>> built with the -release switch?
>
> All -release does is not generate code for assert()s. To leave
> the asserts in, do not use -release. If you still want the
> asserts to be in even with -release,
>
> if (condition) assert(0);
The reason I queried your approach here is because I feel you're
conflating two things:
* the _definition_ of an Exception vs. an Error, on which we
100%
agree: the former as an anticipated possibility which a
program
is committed to try and handle, the latter a failure which
is
fundamentally wrong and should not happen under any
conditions.
* the way in which a program should report these different
kinds
of error.
You seem to be advocating that, by definition, Exceptions and
Errors should be reported differently (one without, and one with,
a trace). I don't at all object to that as a sensible default,
but I think that the ultimate decision on how Exceptions and
Errors report themselves should be in the hands of the program
developer, depending on the use-case of the application.
More information about the Digitalmars-d
mailing list