On Tuesday, 24 May 2022 at 06:12:40 UTC, forkit wrote:
>First, I have to 'remember' that assert is removed in -release, but that depends on how you've actually used it.
Then, in order to leave my assert's in production code, I need to 'remember' not to compile with -release, but rather -someothercrap I can't remember at the moment.
Relying on command line options to make a fishy code work in the way you want is a bad style. The logic of your code should be correct regardless of the used command line options.
You just need to remember to use 'enforce' instead of 'assert'. People coming from C background normally know that they can't count on asserts remaining in the compiled binaries and don't use them for the checks that shouldn't be omitted. But if you are coming from Rust, then you may indeed find the 'assert' vs. 'enforce' naming confusing.
But I doubt that 'assert' makes D language unpopular. It's getting way too much attention here ;-)