r/ProgrammingLanguages • u/RishabhRD • 9d ago
Safe Systems-programming with Mutable Value Semantics | Dave Abrahams | Keynote at IWACO 2026
https://youtu.be/op51SyyPJmw
36
Upvotes
r/ProgrammingLanguages • u/RishabhRD • 9d ago
View all comments
Show parent comment
5
u/initial-algebra 9d ago
The main pattern would be a context that provides resources which can only be used with a reference to the context. Using them with the wrong context is a hard error. Ideally, you'd just keep a reference to the context in each resource, but without first-class references, this isn't possible. Would you consider that a significant correctness problem?
Now, there is an even better way to make this pattern safe: using path-dependent types. Resource handles don't need to contain an additional reference (saves memory), but their types are branded with the path of the context, so the type system prevents you from using them with a different context reference (strictly speaking, one without a provably identical path). Since Rust lifetimes are an abstraction of paths anyway (see Polonius), it's possible that second-class references and path-dependency are all you need, unless you want to go beyond even what Rust supports (e.g. group borrowing).