| |
| Posted by Siarhei Siamashka in reply to forkit | PermalinkReply |
|
Siarhei Siamashka
Posted in reply to forkit
| 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 enforce , no?
argh!
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."
https://doc.rust-lang.org/std/macro.assert.html
"enforce" in D is the same as "assert!" in Rust
"assert" in D is the same as "debug_assert!" in Rust
Looks like you are only unhappy about names, but all the necessary functionality is available.
|