Want reasonable reference counting? Disable automatic sharing of immutable

Steven Schveighoffer schveiguy at gmail.com
Mon Nov 15 14:10:44 UTC 2021


On 11/15/21 2:05 AM, Walter Bright wrote:
> On 11/14/2021 1:12 PM, Steven Schveighoffer wrote:
>> First, I'll note that `__mutable` on its own is perfectly sound.
> 
> I don't think so. It produces two kinds of immutability - one with 
> mutable members, one with not. Different rules apply.

I mean it's sound in that the type checking is valid. You are allowed to 
convert mutable to mutable, so having an always-mutable island is a 
valid. Whether it's *confusing* or not is a different story, and that 
part I agree with you.

Without additional type qualifiers, confusion would always remain.

-Steve


More information about the Digitalmars-d mailing list