The 3d mental borrow checker breakdown

Some languages can analyze the full program, with all the costs it brings. This proposal still keeps everything in the signature, but you declare everything you will borrow up-front. With the syntax from the article, it would see these signatures and determine that they can be borrowed simultaneously:

fn get_a(&mut { a } self) -> &u32
fn get_b(&mut { b } self) -> &u32

Yep, that's also a way of getting around it when you know they will be used together. I have also seen collection types have methods for requesting multiple elements with disjoint indices. It gets the job done to some extent.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.