Challenge: write a reference counted slice that works as much as possible like a built-in slice

tsbockman thomas.bockman at gmail.com
Wed Nov 10 20:28:17 UTC 2021


On Tuesday, 9 November 2021 at 17:04:29 UTC, Paul Backus wrote:
> On Tuesday, 9 November 2021 at 06:32:40 UTC, tsbockman wrote:
>> On Tuesday, 9 November 2021 at 03:43:01 UTC, Paul Backus wrote:
>> How? All of the runtime borrow checking schemes that I have 
>> considered turn out to have the same fundamental problems as 
>> reference counting, when examined closely.
>
> Here's a basic sketch of the scheme I had in mind: 
> https://gist.github.com/run-dlang/d1982a29423b2cb545bc9fa452d94c5e

Thanks.

> It's entirely possible I've overlooked something and this is 
> actually unsound. As Andrei says: "destroy!"

The general idea is possibly sound, although the current 
implementation definitely is not.

If your runtime borrow checks were combined with the language 
enhancements that I suggested in our previous discussion, I think 
it might actually be possible to write a nice `@safe` reference 
counting API that supports `@safe` 
reassignment/reallocation/resizing.

https://forum.dlang.org/post/zsjqqeftthxtfkytrnwp@forum.dlang.org
https://issues.dlang.org/show_bug.cgi?id=21981


More information about the Digitalmars-d mailing list