Prototype of Ownership/Borrowing System for D

victoroak anyone at one.com
Tue Nov 26 17:31:42 UTC 2019


On Tuesday, 26 November 2019 at 09:34:55 UTC, Walter Bright wrote:
>
> I understand that the salient difference between your scheme 
> and mine is you attach it to the pointer type while mine 
> attaches it to the function. Pretty much all of this discussion 
> is about consequences of this difference, so I don't think it 
> is necessary to go through it point-by-point agreeing with you 
> on those consequences.
>

I think another great difference is that in your proposal a 
pointer has ownership of the memory but I think that structs 
should have ownership over resources and pointers are only 
borrows (like references in Rust), this way is more useful and 
lets you track ownership over other resources other than memory.

Another point is that on Timon's proposal scope pointers can be 
members of structs so you can have a safe slice that borrows from 
a container.



More information about the Digitalmars-d mailing list