Rue instead of Rust: Just as safe, but easier to access
The programming language Rue combines the advantages of Rust with a simpler syntax. The compiler for it is being developed by the AI model Claude.
(Image: rodho/Shutterstock.com)
Rue, a new programming language introduced just before Christmas, combines memory safety with good performance without a garbage collector. It is a further development of Rust, pursuing a similar concept. However, Rue is intended to be more easily accessible, especially for beginners. A special feature is that the AI assistant Claude is developing the compiler (x86-64 and ARM64) for Rue.
Rue was conceived by Steve Klabnik, who played a significant role in Ruby on Rails and Rust. He is trying to simplify Rust's memory-safe borrowing concept, which many Rust newcomers find difficult to understand.
Videos by heise
Rue uses affine types with mutable value semantics. This means that developers can only use affine types once. The blog shows an example:
struct FileHandle { fd: i32 }
fn example() {
let handle = FileHandle { fd: 42 };
use_handle(handle); // handle moves here
use_handle(handle); // ERROR: value already moved
}
However, copying is possible if explicitly declared:
@copy
struct Point { x: i32, y: i32 }
fn example() {
let p = Point { x: 1, y: 2 };
use_point(p); // p is copied
use_point(p); // OK, p is still valid
}
A value that must be consumed can be marked with linear:
linear struct DatabaseTransaction { conn_id: i32 }
fn example() {
let tx = DatabaseTransaction { conn_id: 1 };
// ERROR: linear value dropped without being consumed
}
From Zig, Rue adopts the concept of expressions that the compiler already evaluates, with the property comptime. Types can also be created this way:
fn Pair(comptime T: type) -> type {
struct { first: T, second: T }
}
fn main() -> i32 {
let IntPair = Pair(i32);
let p: IntPair = IntPair { first: 20, second: 22 };
p.first + p.second
}
Klabnik is working with Claude to implement his ideas. Although he had an idea of what Rue should look like, he lacked the experience in building compilers. This task is handled by artificial intelligence: "And you know what? It worked." The first attempt to compile a program didn't work, but after a debugging session, it ran.
The Rue website emphasizes that it is a research project in its early stages and not yet ready for real projects. Those who want to get involved can find an opportunity on GitHub.
(who)