On Wednesday, 11 July 2018 at 22:46:45 UTC, xray wrote:
[ .. ]

After watching the Dconf 2018 session about "Safe Memory Management", I told myself that, if D can guarantee an exception in the case we delete an already deleted object, then it's a major step forward. So let's assume that.

This can be done with a library solution.

Now, let's distinguish two kind of references, one being "owner" of the object it targets, and other that are smooth references to the same object.

We could say that a given object will always belong to one and only one owner. This owner will be in charge of deleting the object.

So something like this?

https://github.com/atilaneves/automem/blob/master/source/automem/unique.d

void main()
{
[...]
}

The only thing I got from this are that "smooth references" are like Rust's borrows. Which just gave me the idea to add this member function to `Unique`:

scope ref T borrow();

I have to think about @safety guarantees but it should be ok with DIP 1000.

Atila

Reply via email to