Prototype of Ownership/Borrowing System for D

Timon Gehr timon.gehr at gmx.ch
Wed Nov 20 12:16:29 UTC 2019


On 20.11.19 05:59, Walter Bright wrote:
> https://github.com/dlang/dmd/pull/10586
> 
> It's entirely opt-in by adding the `@live` attribute on a function, and 
> the implementation is pretty much contained in one module, so it doesn't 
> disrupt the rest of the compiler.

I will look into this in on the weekend, but I think it would help if 
you could answer the following questions:

- What do you want to achieve with borrowing/ownership in D?

- What can already be done with @live? (Ideally with runnable code 
examples.)

- How will I write a compiler-checked memory safe program that uses 
varied allocation strategies, including plain malloc, tracing GC and 
reference counting?


Right now, the only use I can see for @live is as an incomplete and 
unsound linting tool in @system code. It doesn't make @safe code any 
more expressive. To me, added expressiveness in @safe code is the whole 
point of a borrowing scheme.


More information about the Digitalmars-d mailing list