News for hackers. Stuff that matters.
Re:Programming Languages Going Above and Beyond by thesuperbigfrog on Thursday June 29, 2023 @09:25AM (#36520041)
"Dafny’s ability to statically check critical properties of your program goes well beyond what mainstream languages can do (that includes you, Rust)."

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...

Re:Programming Languages Going Above and Beyond by lionkor on Thursday June 29, 2023 @09:30AM (#36520097)
> Rust has Design by Contract capabilities via the contracts crate

And C++ has reflection using boost ;)

Re:Programming Languages Going Above and Beyond by thesuperbigfrog on Thursday June 29, 2023 @09:33AM (#36520132)
Re:Programming Languages Going Above and Beyond by jakuj on Thursday June 29, 2023 @10:12AM (#36520595)
You might be interested in the Prusti project, which statically checks for absence of reachable panics, overflows etc. It also allows user-defined specifications such as pre and post-conditions, loop body invariants, termination checking and so on.

https://github.com/viperproject/prusti-dev

Re:Programming Languages Going Above and Beyond by perlgeek on Thursday June 29, 2023 @10:29AM (#36520820)
In Eiffel at least, the contracts are checked at run time, whereas in Dafny it seems that it's verified at compile time.

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.

Re:Programming Languages Going Above and Beyond by redjamjar on Thursday June 29, 2023 @05:24PM (#36526945)
Yeah, SPARK/Ada is a comparable system to Dafny. I agree with that! Also, Frama-C and a bunch of other more esoteric research languages as well.