Object.toString, toHash, opCmp, opEquals

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Fri Apr 26 06:10:38 UTC 2024


On 26/04/2024 6:02 PM, Walter Bright wrote:
> On 4/25/2024 8:21 PM, Richard (Rikki) Andrew Cattermole wrote:
>> If this is literally the *only* thing blocking RC, I can do the DIP 
>> for it.
> 
> The other problem with RC is the exception handler for every decrement. 
> If there's a DIP in it, please do so!

With struct destructors the unwinding table should already be in use.

So it is a cost we are already paying, that shouldn't be something to 
worry about as it is not a new cost.

On that note, unwinding tables need to be turned on for -betterC in dmd. 
Turning them off can only cause program corruption when calling non 
-betterC code including C/C++. https://github.com/dlang/dmd/pull/16177

But yes, I'll start working on a DIP!

Although I need to talk with Dennis. DIP1000 isn't doing what I would 
expect it to do for slices:

```d
import std;
void main() @safe {
     Context context;
     char[] str = context.acquire();
     char[] var = test(str);
     writeln(var); // Should be erroring with: scope variable `var` 
assigned to non-scope parameter `__param_0` calling `writeln`
}

struct Context {
     char[] acquire() scope return @trusted {
         return "Abc".dup;
     }
}

char[] test(return char[] input) @safe {
     return input;
}
```

It does for ``void*``.


More information about the Digitalmars-d mailing list