My Long Term Vision for the D programming language

rikki cattermole rikki at cattermole.co.nz
Sat Nov 20 01:59:07 UTC 2021


On 20/11/2021 2:21 PM, Ola Fosheim Grøstad wrote:
> On Saturday, 20 November 2021 at 00:55:36 UTC, rikki cattermole wrote:
>> For system resources, I think this is the best way forward. Due to the 
>> fact that threads actually matter here, and you really need to "free" 
>> resources where they were allocated. But also allow references to leak 
>> to other threads.
> 
> Yes. Regardless, ARC requires more compiler restructuring.

To me ARC is just what we have now with a couple of compiler hooks. So 
it shouldn't need restructuring for this.

> Right now regular RC + local GC is the easy implementation...
> 
> But regular RC is not convincing anyone, sigh...

I use it, but it is expensive, I know this. But it is the only way to 
make the resources go away guaranteed (unless something messes with the 
thread state).

However a lot of the usage of the RC could work with scope and possibly 
even const. So there is a lot of potential easy optimizations being 
missed due to the fact that we don't have the methods to call 
specifically for RC.

I.e.

void someFunc(scope RCData data) {
	someOtherFunc(data);
}

At no point from that point forward would RC methods need to be called. 
But copy constructors, postblit and destructors would need to be called 
regardless on a struct. Its a real shame.


More information about the Digitalmars-d mailing list