News for hackers. Stuff that matters.
Re:Show HN: Design by Contract (tm) – C++ by ncmncm on Sunday December 13, 2020 @08:56PM (#25412652)
Every pre-, post-, and invariant condition violation represents a programming error, at an indeterminate point in the past, rendering the state of the computation unknown, and likely undefined, and definitely unrecoverable.

An exception, by definition, is to enable recovery from externally imposed events in a well-defined program state.

The only useful, meaningful response to discovering a contract violation is termination. Throwing an exception is the worst imaginable response.

Re:Show HN: Design by Contract (tm) – C++ by Bambo on Monday December 14, 2020 @03:23PM (#25422763)
The exception throwing is a compromise, it allows you to view the stack trace in an IDE to find out which assertions failed.