Want reasonable reference counting? Disable automatic sharing of immutable

Stanislav Blinov stanislav.blinov at gmail.com
Sat Nov 13 00:27:30 UTC 2021


On Friday, 12 November 2021 at 23:50:15 UTC, Steven Schveighoffer 
wrote:

> That means every pure function must be passed the global table 
> as a parameter *just in case* there are some reference-counting 
> things to do, and that means that no pure function can be 
> strong-pure. Might as well not have pure functions in that case.

Might as well. So long as you're using (current spec of) GC, pure 
functions are a big fat lie. Not even because GC allocates, but 
because it runs finalizers, which can be impure. If a compiler 
makes any assumptions wrt. "pure" on a function that interacts 
with GC in any way, they're gonna be wrong assumptions.


More information about the Digitalmars-d mailing list