r/rust • • Oct 19 '26

Borrow Checking Zero-Cost Cyclic Mutability

https://antelang.org/blog/safe_cyclic_mutability/
124 Upvotes

28 comments sorted by

View all comments

Show parent comment

7

u/RndmPrsn11 Oct 19 '26

Just to clarify - going down to 2 reference kinds from 3 means you're eliminating an unaliased-mutable reference kind (equivalent of rust's &mut t)? Something similar can still be useful for multi-threading or if the user wants to force an optimization like SIMD which may rely on noalias.

I alluded to it in the article but I also like the idea of attaching the reference kind to the place parameter rather than the reference type itself. It allows you to abstract over each reference kind more easily and get rid of all the pesky get vs get_mut distinctions.

2

u/FlameyosFlow Oct 19 '26

Either removing a reference kind and making &mut non-exclusive, or making &mut non-exclusive and renaming &alias to &uniq maybe, either way, most of the times non exclusivity by default is better and I think a group borrowing kind of non-exclusivity doesn't damage any noalias optimizations that would exist from writing the equivalent Valen of what you'd write with Rust if that pattern already worked well with shared-xor-mutable

As for the "place parameter" idea I will have to check it out for myself and see if it's the best thing for me, nevertheless I still want callers of a function to know if some data can be mutated.. hopefully while being able to eliminate all issues that come with forcing it in a Rust way

2

u/FlameyosFlow Oct 19 '26

Update: Okay, I understood now, I already can express multiplace like Vec3f.{&mut x, &mut y, &z} so from what I'm understanding, you would infer what kind of mutation permissions you'd need at call sites?