Re: Why do immutable variables need reference counting?

2022-04-10 Thread rikki cattermole via Digitalmars-d-learn
Storage classes like immutable/const/shared are not tied to any memory management strategy. Nor does it dictate memory lifetime. It only dictates how it can be interacted with when you have a reference to it.

Re: Why do immutable variables need reference counting?

2022-04-10 Thread Ali Çehreli via Digitalmars-d-learn
On 4/10/22 20:05, norm wrote: > On Sunday, 10 April 2022 at 23:19:47 UTC, rikki cattermole wrote: > In my mind immutable data > means the data will not change and neither will the result of reading > that data, ever. Yes. > I don't get how you can have thread safety guarantees based on immutabl

Re: Why do immutable variables need reference counting?

2022-04-10 Thread norm via Digitalmars-d-learn
On Sunday, 10 April 2022 at 23:19:47 UTC, rikki cattermole wrote: immutable isn't tied to lifetime semantics. It only says that this memory will never be modified by anyone during its lifetime. This is clearly where I am misunderstanding. In my mind immutable data means the data will not ch

Re: Why do immutable variables need reference counting?

2022-04-10 Thread rikki cattermole via Digitalmars-d-learn
immutable isn't tied to lifetime semantics. It only says that this memory will never be modified by anyone during its lifetime. Anyway, the real problem is with const. Both mutable and immutable become it automatically.

Why do immutable variables need reference counting?

2022-04-10 Thread norm via Digitalmars-d-learn
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