Ownership and Borrowing in D

Sebastiaan Koppe mail at skoppe.eu
Tue Jul 23 22:01:56 UTC 2019


On Tuesday, 23 July 2019 at 19:15:44 UTC, Olivier FAURE wrote:
> That's as good a time as any to plug my own proposal draft:
>
> https://gist.github.com/PoignardAzur/9896ddb17b9f6d6f3d0fa5e6fe1a7088
>
> Any thoughts?

So in a nutshell, a variable with the unique qualifier ensures 
that there are no other references to that data during the 
lifetime of said variable? In other words, you can only take 1 
addressOf/ref at a time?

Does it prevent more that just use-after-free?

Random idea: what about an @owned destructor? One that only runs 
on the original object, not on any of its copies. Which implies 
scope of course, so that nothing of the copies or its internals 
are allowed to escape.


More information about the Digitalmars-d-announce mailing list