Want reasonable reference counting? Disable automatic sharing of immutable
Daniel N
no at public.email
Sun Nov 14 18:52:35 UTC 2021
On Sunday, 14 November 2021 at 18:08:29 UTC, Walter Bright wrote:
> Sometimes the obvious way is the best way!
>
> Note that one still can have an immutable *payload* for a ref
> counted object.
Maybe, it is reasonable, but I think we didn't fully explore
mutable, we simply have to take a different route than C++ did.
As I see it, the problem in D is forced transitivity.
immutable(mutable(int)) = immutable(int) (Unlike C++ !)
immutable(mutable(int)*) = immutable pointer to mutable int
Punching holes in immutable objects like C++ did causes major
issues as the object might be stored in read-only memory or
shared, etc.
More information about the Digitalmars-d
mailing list