-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tell if Stopify is “running” #512
Comments
OK, I think we have this working with this:
Relevant comment for Stopify/stopify/src/runtime/abstractRunner.ts Line 200 in 275d950
Then our predicate is:
@blerner and I spent some time reconstructing this. I think this could be useful as an exposed API, though may end up finding other cases where the state needs to be managed a bit to have |
Here's a problem: We want Pyret's arrays to be the same kind of arrays as those on the rest of the page.
We don't want to enforce a wrapping/unwrapping step at the Pyret boundary; we've tried this in other implementations and it's a huge headache (think nested arrays, 3rd party libraries that
.map
, etc).The current polyfill strategy for HoFs makes Stopified arrays special. If a client of some Stopified code tries to
map
orfilter
on an array, they'll almost certainly get (nondeterministically!) some kind of uncaught Capture or similar, because that array's callbacks have been replaced. For the same reason, it doesn't work to patch in the Stopified polyfills on the array prototype, since that would break innocuous non-stopped code.One thing we'd like to try is writing polyfills with a dispatch, for example:
Thing is, we can't figure out how to write
isStopifyRunning()
There's a lot of states Stopify can be in – is there a way provided by the Stopify runtime to write this predicate? We tried various combinations of
eventMode
andrts.mode
andrts.capturing
, but can't seem to express it. Is there a concise way to tell if the stack is currently a Stopify stack that's ready for captures/suspends, or if it's on the plain JS stack?The text was updated successfully, but these errors were encountered: