against enforce

Kagamin spam at here.lot
Fri Mar 25 12:36:05 PDT 2011


>I can't think of an occasion when I would want to have my uses of 
>enforce() stripped for a release build.

Ideally enforce shouldn't have side effects, so its removal shouldn't affect your business logic.

>Removing asserts once I am sure 
>that my code has no logic errors make sense

Did you ever have this sense? Well, I can be sure "hello world" has no bugs, but for something more complex... only if you're a programming god, but even then your way won't suit us mortals.

>Performance is irrelevant if you are processing corrupted memory or 
>malformed input.

I believe, sometimes it's easier to make sure that the input is correct, than to make sure the code has no bugs.

>This means that libraries (should) have 2 types of assert, 
>but I hesitate to suggest the creation of a synonym to help better 
>document the difference between them, as I find that the use of in{} and 
>out{} do a pretty good job of that already.

So you suggest to check iota's input in contract? They say, phobos is compiled with -release flag, so all contracts are removed. Is it ok for D programmers?


More information about the Digitalmars-d mailing list