collectNoStack should be axed

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Sun Apr 21 21:21:57 UTC 2024


On 22/04/2024 9:07 AM, Walter Bright wrote:
> On 4/21/2024 1:01 PM, Richard (Rikki) Andrew Cattermole wrote:
>> I can't even get Walter to agree to have RC in the language (even if 
>> it is reluctantly), let alone that...
> 
> A few years back, we really tried to find a way to do it that was memory 
> safe. We failed. Timon presented us with a use-after-free case that we 
> couldn't resolve. Re-orienting D around a memory-unsafe construct is not 
> the future for D.
> 
> There's also the problem that the decrement has to be in a finally 
> block, because of exceptions, which makes things bloated and slow.

I suspect that I need to learn more about the exception hooks.

My current understanding is that there is a subset that are entirely 
optional and are only needed to be called if cleanup occurs. Not quite 
the same thing as an exception catch.

> P.S. A borrow checker resolves the use-after-free case, but RC isn't 
> needed if one is using a borrow checker.

You are applying the borrow checker to both the owner and the borrow.

I want it only on the borrow.

The borrow isn't exclusive, it doesn't have the guarantees isolated 
would give. All it guarantees is that the borrow cannot escape the owner.

If you apply the borrow checker to the owner as well, you miss out on 
the ability to use it with data structures, DOM's, that sort of thing. 
All things I want to use it for.


More information about the Digitalmars-d mailing list