On Borrow Checking
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Sun May 4 22:49:22 UTC 2025
On 05/05/2025 8:50 AM, Walter Bright wrote:
> The point of the borrow checker is to ensure there is exactly one point
> of origin for a pointer and exactly one point of termination for it.
Hang on, that isn't the point of it at all.
A borrow checker has got the _side effect_ of only having one entry and
exit point for an object.
But the _objective_ is to loosen the restrictions that an _ownership
transfer system_ imposes on the type system whilst keeping its guarantees.
We do not have an ownership transfer system in D. Therefore we cannnot
have a borrow checker.
What we do have is a liveliness analysis with guaranteed modelability,
and we do have a use for that, @restrict.
Enforcing @restrict could be an incredibly useful tool to those who do
data processing with simd, right now they are doing this by hand.
More information about the Digitalmars-d
mailing list