Program logic bugs vs input/environmental errors

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Mon Oct 6 19:55:23 PDT 2014


On 10/6/2014 10:09 AM, Dicebot wrote:
> It is only in undefined state because language handles Errors that way. At the
> point of throwing the Error state was perfectly defined and 100% recoverable.
> This is the typical case for assertion failure in contract - it detects some
> program flaw like inability to handle specific data combination from other
> process but it does not mean memory is corrupted or program is inherently
> broken. Just killing the fiber and continuing with other requests (which don't
> trigger that unexpected code path) is absolutely fine unless compiler kicks in
> and optimizes something away in surprising fashion.

What you're describing sounds like using asserts to validate input data. This is 
not what asserts are for.



More information about the Digitalmars-d mailing list