Prototype of Ownership/Borrowing System for D

Ola Fosheim Grøstad ola.fosheim.grostad at
Wed Nov 27 11:12:55 UTC 2019

On Wednesday, 27 November 2019 at 10:24:57 UTC, rikki cattermole 
> Am I completely bonkers to think that this might be a workable 
> solution?

You need to ensure at least the following:

- nobody reads the pointer and puts it somewhere else
- nobody reads any pointer reachable from the root pointer and 
puts it somewhere else
- the root pointer does not point to any datatype that can be 
modified/extended with new pointers (like a dynamic array of 
pointers or a non-const pointer)

But that isn't enough, is it? You could have an integer-id as 
parameter that index a global array with pointers... so it also 
has to be @pure.

To get to something useful the common assumption should be that 
you need lifetime-names/variables under the hood. No point in 
wasting time thinking otherwise... unless someone has written a 
paper on it.

More information about the Digitalmars-d mailing list