Verifying Dynamic Trait Objects in Rust (2022)
dl.acm.org
dl.acm.org
I don't know how practical this system is but the practical prospect of semi-formally reasoning about critical parts of programs seems very exciting to me, especially with AI possibly revolutionizing software development on the horizon.
package hello
type namer interface {
first() string
last() string
}
func name(n namer) string {
return n.first() + " " + n.last()
}
I think I saw on a blog post that Rust can only do this with some hacks, is that true? trait Namer {
fn first(&self) -> String;
fn last(&self) -> String;
// You can put this here if you want `namer.name()`
fn name(&self) -> String {
format!("{} {}", self.first(), self.last())
}
}
fn name(n: &impl Namer) -> String {
format!("{} {}", n.first(), n.last())
}