by thesuperbigfrog · 3y ago · 0 comments
Ada supports Design by Contract preconditions, postconditions, and type invariants that were pioneered by the Eiffel programming language:
https://learn.adacore.com/courses/intro-to-ada/chapters/cont...
The SPARK subset of Ada also does static proofs / formal verification:
https://learn.adacore.com/courses/intro-to-spark/chapters/01...
===
Rust has Design by Contract capabilities via the contracts crate:
https://docs.rs/contracts/latest/contracts/
Maybe one day Rust will have formal verification too?
Work is under way: https://alastairreid.github.io/automatic-rust-verification-t...
I think (but I'm not sure) that Eiffel disables recursive contract checking (so checking a contract of a function used for checking the contract), so you could put the check for the inverse in each of the function's post conditions, but it would be quite the performance hit to verify it at each call.
And C++ has reflection using boost ;)
https://www.reddit.com/r/cpp/comments/cmk7ek/what_happened_t...
Not sure if / when they will land:
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p05...