We have many types of assert macro just for printing more helpful messages. We only need one type of them. (Of course, we won’t get rid of debug_assert since it’s completely a different variant.)
Make everything fit within the assert macro. For example, if the final operation is “==”, make it like assert_eq. We should also expand this to ordering operators like “<”. There are many frameworks mostly in C++ like Catch and Boost.Test already achieves that using macros. The problem with C++ macros is that they’re hard to write and they doesn’t always yield the desired behavior. However, Rust’s compiler (procedural) macros are very powerful, we can access the AST for precise parsing. We may also print out the immediate expressions, like [1 + 2 != 3]. This needs further discussion.
- should we make assert! a compiler built-in? Can this done with macro_rules?
- should we print out all values contained in the expression?