3 ms·
Assertions should be more debugger-oriented
- nyanpasu64 4y agoYou can type `f 4` to jump directly to the function running before entering the assertion machinery.
- nealabq 4y agoAsserts play different roles: 1. Invariant assurance when entering/exiting an operation. 2. Argument checking. Enforcing requirements as to how an API is to be used. 3. Documenting the state of an operation as it proceeds. This is a kind of logging. 4. Acting like a kind of insiders (pre-)unit-testing. Ensuring certain assumptions are not violated as a function is put together, or as it evolves in the future. I consider debugging, manual (initial) testing, automated testing, asserts, logging, long-term monitoring, and even commenting as somewhat related. But I don't know the best way to unify these things or even if that's desirable.