On Sunday, 22 May 2022 at 11:49:27 UTC, forkit wrote:>
On Friday, 20 May 2022 at 06:40:30 UTC, Tejas wrote:>
Isn't the advice to use
enforce for handling/verifying input in release builds and
assert for development builds though?
Yeah, it's violating DRY if a particular check needs to be done in both development and release, but then one can skip the
assert and just do
I often forget that D removes assert in release mode :-(
If only we had Rust style asserts.
And by that, I specifically mean:
"Assertions are always checked in both debug and release builds, and cannot be disabled. See debug_assert! for assertions that are not enabled in release builds by default."
We actually have this in D, it's just written weirdly:
// debug assertion assert(condition); // release assertion if (!condition) assert(0);
It would probably be more intuitive if we could write release assertions as plain
assert, and use
debug assert for debug assertions. But the functionality is there.