Why is GC.collect `pure`
Nick Treleaven
nick at geany.org
Wed Aug 2 18:02:35 UTC 2023
On Wednesday, 2 August 2023 at 17:55:12 UTC, Nick Treleaven wrote:
> On Wednesday, 2 August 2023 at 17:52:00 UTC, Nick Treleaven
> wrote:
>> Now I'm wondering why those functions are marked `pure` - they
>> must affect the GC's bookkeeping state.
I guess it was because the GC's internal state is not supposed to
be observable outside internal GC functions. I find it harder to
accept some of those than `GC.malloc` being pure, because
GC.disable and GC.enable will affect how long future allocations
will take. That latency can be significant and observed by the
program. Also conceptually they are changing GC state.
More information about the Digitalmars-d-learn
mailing list