Want reasonable reference counting? Disable automatic sharing of immutable

Timon Gehr timon.gehr at gmx.ch
Sun Nov 14 18:25:00 UTC 2021


On 14.11.21 19:08, Walter Bright wrote:
> On 11/14/2021 10:02 AM, Timon Gehr wrote:
>> On 14.11.21 08:16, 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.
>>
>> Yes, this is definitely a reasonable way to resolve this debate.
> 
> Sometimes the obvious way is the best way!
> 
> Note that one still can have an immutable *payload* for a ref counted 
> object.

I am not sold on that yet. How do you manually deallocate an immutable 
payload?


More information about the Digitalmars-d mailing list