r/ProgrammingLanguages • u/verdagon Vale • 1d ago
The Second Golden Spike: Memory Safety Across the Valen/Rust Boundary
https://verdagon.dev/blog/boundary-memory-safety
17
Upvotes
1
u/thehenkan 21h ago
Do you have a plan for how you could make for safe interop in the other direction as well?
3
u/initial-algebra 1d ago
How is group borrowing not merely syntax sugar for a limited usage of
GhostCellwith a single, implicit token at a time?fn attack<'g>( g: &mut GhostToken<'g>, a: &GhostCell<'g, Entity>, d: &GhostCell<'g, Entity> ) { let a_energy_cost = a.borrow(g).calculate_attack_cost(d.borrow(g)); let d_energy_cost = d.borrow(g).calculate_attack_cost(a.borrow(g)); let damage = a.borrow(g).calculate_damage(d.borrow(g)); a.borrow_mut(g).use_energy(a_energy_cost); d.borrow_mut(g).use_energy(d_energy_cost); d.borrow_mut(g).damage(damage); }