collectNoStack should be axed

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Mon Apr 22 01:56:05 UTC 2024


On 22/04/2024 9:21 AM, Richard (Rikki) Andrew Cattermole wrote:
> 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.

After reviewing Windows documentation and assembly for linux, it appears 
my previous understanding is correct.

You only have to deal with cleanup which is checked for anyway, if you 
throw an exception.

So in other words, slow path only. I don't understand the issue here.

It is equivalent to a struct stored on the stack having its destructor 
called when an exception is thrown.


More information about the Digitalmars-d mailing list