Borrow Checking and Ownership Transfer
jmh530
john.michael.hall at gmail.com
Fri May 9 19:15:11 UTC 2025
On Friday, 9 May 2025 at 18:28:11 UTC, Richard (Rikki) Andrew
Cattermole wrote:
> On 10/05/2025 5:17 AM, jmh530 wrote:
>> To your point about being a property of a pointer, the
>> alternative approach is to introduce a reference that is
>> borrow checked. Yes, it results in additional pointer types,
>> but if that's the approach that Rust ultimately relies on and
>> it's the only way to achieve what we want, then it's what
>> should be done.
>
> I want to touch upon this because its misunderstood quite
> widely regarding the difference between Rust's borrow checker
> and ownership transfer system.
>
> The borrow checker loosens restrictions placed upon you by the
> ownership transfer system to give strong guarantees of aliasing
> and lifetimes. If you did not have the borrow checker, the
> ownership transfer systems restrictions would make things
> absolutely impossible to work with.
> [snip]
Not sure I completely follow everything here, but is your point
that to actually do what Rust is doing we need the
ownership/borrowing system plus borrow checking?
More information about the Digitalmars-d
mailing list