You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, callbacks that are executed by run_now can affect the caller, but we don't want this.
My understanding is that if we execute the callbacks with R_TopLevelExec, it acts as a barrier which exceptions and returns won't cross.
Here's an example that demostrates the return issue (adapted from callCC) where an early return affects the run_now, and prevents subsequent callbacks from being executed:
The f() returns 100, but that's not what we'd expect. Also, the subsequent callback with message("hello") just doesn't execute. For some reason, after running this code, the callbacks no longer run at an idle console. I think this is probably related to the early return. Calling run_now() again does execute the message("hello"), however.
Although the example above uses an unusual case (an early return) I believe a similar thing happens with exceptions, and I think that the R_TopLevelExec will prevent these problems.
The text was updated successfully, but these errors were encountered:
Currently, callbacks that are executed by
run_now
can affect the caller, but we don't want this.My understanding is that if we execute the callbacks with
R_TopLevelExec
, it acts as a barrier which exceptions and returns won't cross.Here's an example that demostrates the
return
issue (adapted fromcallCC
) where an earlyreturn
affects therun_now
, and prevents subsequent callbacks from being executed:The
f()
returns100
, but that's not what we'd expect. Also, the subsequent callback withmessage("hello")
just doesn't execute. For some reason, after running this code, the callbacks no longer run at an idle console. I think this is probably related to the early return. Callingrun_now()
again does execute themessage("hello")
, however.Although the example above uses an unusual case (an early
return
) I believe a similar thing happens with exceptions, and I think that theR_TopLevelExec
will prevent these problems.The text was updated successfully, but these errors were encountered: