Want reasonable reference counting? Disable automatic sharing of immutable

Timon Gehr timon.gehr at gmx.ch
Sun Nov 14 21:29:46 UTC 2021


On 14.11.21 21:46, H. S. Teoh wrote:
> The thing is that `in` is touted (in tutorials, documentation, and
> sometimes in advice to D newbies) as a good practice for function
> parameters when the function is not modifying data. In practice,
> however, this is only applicable to PODs and aggregates 1 or 2 levels
> above that. Beyond that `in` basically adds no value, since as you
> mentioned, it excludes a lot of useful idioms like lazy initialization,
> caching, and now ref-counting.
> 
> An entire keyword, spent on a feature that can only be used in code of
> limited complexity.

True, that's not optimal.


More information about the Digitalmars-d mailing list