▲ | nmsmith 4 days ago | |||||||
The "Group Borrowing" concept that we're discussing still imposes aliasing restrictions to prevent unsynchronized concurrent access, and also to prevent "unplanned" aliasing. For example, for the duration of a function call, the default restriction is that a mut argument can only be mutated through the argument's identifier. The caller may be holding other aliases, but the callee doesn't need to be concerned about that, because the mut argument's group is "borrowed" for the duration of the function call. I suppose you could describe the differences from Rust as follows: - Borrowing happens for the duration of a function call, rather than the lifetime of a reference. - We borrow entire groups, rather than individual references. The latter trick is what allows a function to receive mutably aliasing references. Although it receives multiple such references, it only receives one group parameter, and that is what it borrows. Hope that makes sense! | ||||||||
▲ | codedokode 4 days ago | parent [-] | |||||||
> Borrowing happens for the duration of a function call I don't understand this part. Cannot a function store a borrowed reference into a structure that outlives the function? | ||||||||
|