Want reasonable reference counting? Disable automatic sharing of immutable

rikki cattermole rikki at cattermole.co.nz
Sun Nov 14 07:49:10 UTC 2021


On 14/11/2021 8:16 PM, Walter Bright wrote:
> On 11/12/2021 4:31 AM, Steven Schveighoffer wrote:
>> One of the prerequisites to doing reference counting is to have a 
>> mutable piece of data inside an immutable piece of data.
> 
> Or maybe just give up on having immutable ref counted objects. Ref 
> counted objects are mutable.

This isn't entirely true.

If all calls into reference counting have a known delta of zero, all 
calls in are elided therefore nothing changed.

const + scope + ARC has some very interesting possibilities here.


More information about the Digitalmars-d mailing list