Want reasonable reference counting? Disable automatic sharing of immutable

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Fri Nov 12 23:32:42 UTC 2021


On Friday, 12 November 2021 at 23:07:02 UTC, Steven Schveighoffer 
wrote:
> The problem is of course that this is not pure. As long as you 
> don't need pure reference counting, it's a possible solution.
>
> If you do need pure reference counting, this mechanism *cannot* 
> be used, even if it's not technically accessing a global. I 
> don't care what tricks you want to pull, the optimizer is going 
> to bite you for it.

Not if it is built in. Anyway, you can just require all functions 
to take the counter table as a parameter, by rewriting rules, 
that makes it pure even when it isn't builin.

> I'm skeptical that even normal optimizations outside of pure 
> won't bite you on this either.

If it is builtin then optimizations cannot be a concern?




More information about the Digitalmars-d mailing list