red / REP

Red Enhancement Process
BSD 3-Clause "New" or "Revised" License
10 stars 4 forks source link

WISH: way to temporarily disable GC or at least read its state #130

Open hiiamboris opened 2 years ago

hiiamboris commented 2 years ago

We have recycle/on and recycle/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.

greggirwin commented 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.

hiiamboris commented 2 years ago

If you only change state for the code under your control, and restore it upon leaving this code, it should be fine.

dockimbel commented 2 years ago

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.

hiiamboris commented 2 years ago

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.