-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
assert macro for non-release #4263
Comments
Yep, I'm definitely all for it |
The proposal is not very convincing though. |
+1, would be nice to have in stdlib, and during release too. Maybe leave ability to disable it in special circumstances
|
There is a little need in macro if it used in release - you can just do Another thing is that it can modify control flow (type of |
I've been reminded about this again while working on a couple of algorithms where it would be nice to state some invariants in code. In my understanding, the main use case would be for developing a feature or chasing a bug. So these assertions would not even need to execute in development builds (without My point is, I see it basically as a development tool which can help me while actively working on a piece of code. They're persisted, so I can easily enable them when needed. Maybe even the best about it is the documentation function. An invariant clearly expresses the assumptions that the author has about the state of things. Rust has two macros for this purpose:
My main intention would align mostly with |
I've been working on some numeric code that benefits from a lot of invariant checks while developing and testing. However having them all run in release mode is not necessary.
I made a macro that has been helpful. Is this something that you all would want in the language itself?
The text was updated successfully, but these errors were encountered: