Why do immutable variables need reference counting?
user1234
user1234 at 12.de
Mon Apr 11 09:03:55 UTC 2022
On Sunday, 10 April 2022 at 23:05:24 UTC, norm wrote:
> Hi All,
>
> I am clearly misunderstanding something fundamental, and
> probably obvious :D
>
> Reading some of the discussions on __metadata I was wondering
> if someone could explain why a immutable reference counting
> type is needed. By definition a reference counter cannot be
> immutable, so what would be the use case that requires it? It
> cannot really be pure nor safe either because the ref goes out
> of scope and the allocation is freed. How is this immutable?
>
>
> Thanks,
> Norm
refcounting would require a concept of "tail const" / "tail
immutable" so that transitivity of the qualifier does not affect
the data used to refcount (basically the field that hold the
count) but only the data that **are** refcounted.
More information about the Digitalmars-d-learn
mailing list