Prototype of Ownership/Borrowing System for D
rikki cattermole
rikki at cattermole.co.nz
Tue Dec 3 07:14:23 UTC 2019
On 03/12/2019 7:35 PM, Ola Fosheim Grostad wrote:
> On Monday, 2 December 2019 at 23:18:55 UTC, rikki cattermole wrote:
>> There is one key feature that both of us share.
>> Objects life times get owned by a data structure.
>>
>> In both of my examples in the code proposal I linked above were based
>> upon just this. Some sort of object (either a class or the double
>> linked lists nodes) is owned by some sort of data structure (Scoped vs
>> DoubleLinkedList).
>
> Ok, maybe I misread the intent you were conveying. Since I haven't
> watched the talk yet, I don't know how they ensure the integrity. I
> would suspect they use the type system...
Its not described in the talk. It was pretty light on the details we'd need.
>> I am not convinced about their memory region scheme, based upon the
>> talk it looks to be prone to data races with locks. Which is worrying.
>
> It is possible that they intend to use a verifier that prove that
> deadlocks or starvation cannot happen since they design a new language
> from scratch? Or put that on the programmer?
>
> ( they rule out dataraces as only one thread has access to the region)
They rule it out once you 'own' a region.
I'm concerned about how they go about 'owning' it.
E.g. locks end in the same problem as though it was on individual object.
>> But so far I'm getting convinced that my idea isn't completely crazy.
>
> Maybe write up something more detailed? I believe "separation logic" has
> been used for partitioning the heap into groups of objects, but I don't
> know how it works... Probably intricate.
I'm not the right person to do this.
Lifetime's are a bit over my head.
In my code example I hand waved a bunch of details related to it.
But basically its a head const reference tied to the lifetime of the
owning memory e.g. a data structure. That guarantees no pointer
modification at any point in time.
>> I'm going to try and reach out and get a confirmation on how their
>> memory region system works.
>
> You could ask if they have pointers to papers, perhaps?
They do and the project is meant to be released in a couple of weeks.
Right now they don't have a compiler, so yeah... Lots of theory wishy
washy atm.
More information about the Digitalmars-d
mailing list