On 23/05/12 05:22, Steven Schveighoffer wrote:
I have come across a dilemma.

Alex Rønne Petersen has a pull request changing some things in the GC to
pure. I think gc_collect() should be weak-pure, because it could
technically run on any memory allocation (which is already allowed in
pure functions), and it runs in a context that doesn't really affect
execution of the pure function.

So I think it should be able to be run inside a strong pure function.

I am almost certain it should not.

And I think this is quite important. A strongly pure function should be considered to have its own gc, and should not be able to collect any memory it did not allocate itself.

Memory allocation from a pure function might trigger a gc cycle, but it would ONLY look at the memory allocated inside that pure function.

Reply via email to