Open hiiamboris opened 2 years ago
This is a good general design question for any global state. The problem being how to know if the state changed since you last checked it, so you don't restore a state that messes up other code.
If you only change state for the code under your control, and restore it upon leaving this code, it should be fine.
restore its previous state
The GC does not have "states" outside of the moments it's running. There is no "previous" GC state. Garbage collecting is a process, not a data-structure. Please reformulate and elaborate on what you mean precisely.
I have to currently resort to this workaround: without-GC: func [code] [sort/compare [1 1] func [a b] code]
I have no clue what you want to achieve their nor why. Instead of playing once again the guessing game, please be exhaustive and precise in your descriptions.
It has on
and off
states (collector/active?). Come on.
REFINEMENTS:
/on => Turns on garbage collector; returns nothing.
/off => Turns off garbage collector; returns nothing.
We have
recycle/on
andrecycle/off
, but what if I want to disable GC and then restore its previous state (unknown to me)?I have to currently resort to this workaround:
without-GC: func [code] [sort/compare [1 1] func [a b] code]
Would be nice to have a by-design way to do that.