r/ProgrammingLanguages • u/RndmPrsn11 • Oct 19 '26
Borrow Checking Zero-Cost Cyclic Mutability
https://antelang.org/blog/safe_cyclic_mutability/
34
Upvotes
r/ProgrammingLanguages • u/RndmPrsn11 • Oct 19 '26
View all comments
Show parent comment
1
u/RndmPrsn11 Oct 19 '26
I'd push back on any of the rules for loops or closures being hacky. They follow rules for moves 1:1 so I think they're quite clean actually. The rules for effect handlers are a bit hacky I think, but also not yet finalized from a design standpoint. I hope to have time again soon to find a cleaner solution there.
The relationship is already encoded in the unstable place so I don't think a new trait would be necessary (
Mutateitself is also technically unnecessary with polymorphic refs).The invalidation rules already model the immutability rule you mention. Abstract places would be a useful thing to have, I mention them in footnote 6, but they're currently unimplemented. Thankfully, most commonly used types in the stdlib don't require this. Something like
Vecfor example is fine with loaning elements as'v!without a dedicated'v.elements!since there is no other source of unstable refs it needs to differentiate from.