Why do immutable variables need reference counting?

norm norm.rowtree at gmail.com
Sun Apr 10 23:05:24 UTC 2022


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



More information about the Digitalmars-d-learn mailing list