A Grand Vision for Rust
9 hours ago
- #Programming Languages
- #Rust
- #Type Systems
- The author outlines three key directions for Rust's development: improving support for effects, substructural rules, and refinement types.
- Effects in Rust (like const fn, async fn, try fn, gen fn) are part of type-and-effect systems. The author suggests adding more effect guarantees, such as functions that do not unwind, terminate, are deterministic, or do not call host APIs.
- Substructural types in Rust include affine types (use at most once), linear types (use exactly once), and ordered types (use exactly once in order). These provide guarantees against use-after-free, memory leaks, and ensure stable memory locations.
- Refinement types, like pattern types, allow attaching additional guarantees to existing types, improving memory safety without runtime checks. View types could enable holding two mutable references to the same type under certain conditions.
- The author's vision is for Rust to become the safest production-grade language, drawing inspiration from Ada/SPARK, and emphasizes the fun and challenge in fundamentally improving Rust.