3 ms·
That looks incredibly useful. Proving the absence of panics and overflows is already great, and with the annotations you can guarantee properties you'd normally
by wongarsu 4y ago
That looks incredibly useful. Proving the absence of panics and overflows is already great, and with the annotations you can guarantee properties you'd normally write property tests for, like in this example from the docs:
impl List {
#[ensures(self.len() == old(self.len()) + 1)]
pub fn push(&mut self, elem: i32) {
// TODO
}
}
- turboponyy 4y agoCan't wait for dependently typed type systems
- Yoric 4y agoI've written code with dependently typed languages. It's very powerful, but it really is time-consuming. That won't be appropriate for all developments/developers.
- pjmlp 4y agoNo need to wait, you can pick Idris today, but it won't be a productive experience versus mainstream development tooling.
- mboekhoff 4y agoThis really reminds me of design by contract, which I find absolutely fascinating. Another library that implements this, albeit at runtime (and optionally using MIRAI is https://docs.rs/contracts/latest/contracts/ https://docs.rs/contracts/latest/contracts/