so cool! every language should have an invariant keyword.
not sure how one uses it in practice -- most of the operators don't exist on my keyboard.
not sure how one uses it in practice -- most of the operators don't exist on my keyboard.
Today, everybody has Unicode output, and all the math symbols are potentially typeable, but it drives programmers nuts if they have to enter them. If you're going to do a verification system, you have to design it for programmers, not mathematicians, or it won't be used. This is a serious problem with formal methods. The formalism is a means to an end, not an end in itself. The end goal is bug-free code.
Dafny for Rust has potential. One big problem is where to put the assertions inside terse functional notation. This is word wrap in Rust:
s.lines()
.map(|bline| UnicodeSegmentation::graphemes(bline, true)
.collect::<Vec<&str>>())
.map(|line| wordwrapline(&line, maxline, maxword))
.collect::<Vec<String>>()
.join("\n")
OK, where would we put assertions? Maybe intersperse .assert(|arg| assertionexpression)
which is just a passthrough that returns its value but allows
making assertions about what's going through it.