Prototype of Ownership/Borrowing System for D

Ola Fosheim Grøstad ola.fosheim.grostad at
Tue Nov 26 14:10:35 UTC 2019

On Tuesday, 26 November 2019 at 13:07:07 UTC, Timon Gehr wrote:
> Yes, but `scope` does not track the allocator. `scope` 
> restricts lifetime, and possibly aliasing. As I also said, 
> alternatively, and perhaps preferably, we could annotate 
> aliasing restrictions separately, but the accepted DIP1021 
> already introduces some checking against aliasing outside @live 
> code.

One possibility for thread local objects:

Add "lifetime-names" and let scope be one, and deduce as many as 
possible. Then have a stack of thread local allocators (i.e. 

Then let lifetime-name track the allocator-position on that stack.

Then only allow the popping of an allocator when there are no 
pointers carrying the life-time name with allocator-stack-depth 0 

The problem is shared objects...

More information about the Digitalmars-d mailing list