Safe Memory Management and Ownership.

Atila Neves atila.neves at gmail.com
Fri Jul 13 17:12:26 UTC 2018


On Friday, 13 July 2018 at 14:47:59 UTC, jmh530 wrote:
> On Friday, 13 July 2018 at 12:43:20 UTC, Atila Neves wrote:
>>
>> 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
>
> Sounds interesting.
>
> I imagine you could specialize this depending on mutability. 
> Rust allows only one mutable borrow, but eliminated immutable 
> borrows, but you can't mix them. You could also place some 
> restrictions, like dis-allow borrows, only allow immutable 
> borrows, etc.

Rust can do that because it enforces it at compile-time. A D 
solution wouldn't be able to do anything more with immutable 
borrows.


More information about the Digitalmars-d mailing list