Urgent.News

What's breaking now, across thousands of outlets.

Tech

Valen's Memory Safety: A New Kind of Borrow Checking

Valen recently introduced a new flexible borrow checker for Valen, a memory safety approach that aims to combine the power of Rust's borrow checking with the simplicity of reference counting or garbage collection. In this article, Valen focuses on their more relaxed borrow checker.

The article explains that Valen's approach is built on the Group Borrowing proposal, designed by Nick Smith. The core concept of Group Borrowing is that the compiler remembers where references point to, using this information to check program memory safety. Originally designed for the Mojo language, Group Borrowing was nearly abandoned but Valen persisted in its development.

Group Borrowing gives programs memory safety without run-time cost. It catches use-after-free problems at compile time and has fewer restrictions than previous approaches. An example is shown where this error is caught at compile time, demonstrating the approach's flexibility. Group Borrowing accepts patterns that are normally hard for borrow checkers, such as:

1. Multiple read-write borrow references to a single object

2. Complex data structures, including entire graphs of data

3. Free reference pointing to arbitrary graph of data

Group Borrowing resolves the conflict between borrow checking and other approaches by relaxing shared-xor-mutable to no use-after-free. This allows for more flexible borrow checkers, such as those supporting C++ code or Zeta's borrow checker, which can prove when two references point to different parts of the same data.

Written by urgent.news from Hacker News's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

This story

This is one outlet's version. Read the fullest account.

Read the original at verdagon.dev →

More in Tech

More from Sunday 11 October →