I was reading about continuations in Standard ML (SMLofNJ.Cont). I understood what callcc and throw does, but could not understand isolate. The documentation says
Discard all live data from the calling context (except what is reachable from f or x), then call f(x), then exit. This may use much less memory then something like f(x) before exit().
However this does not make any sense to me. I just wanted to know what this function does, with some examples.
MLton does a better job of explaining an implementation of
isolate
usingcallcc
andthrow
:The page continues to explain how to achieve the same effect with less space leaking.
MLton's
CONT
signature has a different documentation line than SML/NJ'sCONT
signature: