New Issue: Details of two flavors of asserts

18024, "mppf", "Details of two flavors of asserts", "2021-07-01T20:39:53Z"

Follow-up to #16810 and #12466.
Related to #13603.

We're thinking that we would like to have two different variations on assert.

  • one would be always on (even with --fast)
  • one would be toggle-able with a chpl flag and normally be disabled with --fast

The rationale for having some assert be able to be always on is that if a program is encountering a bug that would lead to undefined behavior it would be better to fail fast rather than possibly running in to any other horrible consequence that could come from the undefined behavior. Nonetheless, an always-on assert is not a substitute for using throw or other reasonable error handling techniques in libraries.

Rust has this idea and calls the always-on one assert and the disabled-in-release debug_assert.

The goal of this issue is to discuss and try to sort out the details.

Some questions:

  • Should the default assert behavior be toggled off with --fast or no?
  • Should we have different methods like assert / releaseAssert / debugAssert, or should we have an optional argument to assert that indicates which of these it is? What are the exact names of these functions / arguments?