4 ms·
Full continuations capture things you do not want to capture, which easily leads to bugs. Delimited continuations can do everything call/cc can, only faster and
by bjoli 7y ago
Full continuations capture things you do not want to capture, which easily leads to bugs. Delimited continuations can do everything call/cc can, only faster and easier to reason about. Call/cc captures the state of the whole program, which is not what you want. It is expensive, slow and error prone.
In my experience delimited continuations has about 4x less overhead (this is in guile which has really expensive call/cc though) and produces a lot faster code.
Oleg Kiselyov has written a lot about it: http://okmij.org/ftp/continuations/against-callcc.html http://okmij.org/ftp/continuations/against-callcc.html
Matthew Flatt spoke about them at Microsoft research with comparisons to call/cc: https://www.microsoft.com/en-us/research/video/delimited-and-composable-continuations-in-plt-scheme/ https://www.microsoft.com/en-us/research/video/delimited-and...
The gist of both of them are: you never want undelimited continuations even when you think you need them.
Properly implemented delimited continuations will always be faster and more memory efficient than call/cc (except for maybe in chicken scheme) and are imho easier to work with. They also compose with the current continuation which makes them a lot more pleasant.
If you want a practical argument for delimited continuations, watch the video with Matthew Flatt.
- convolvatron 7y agothank you. oleg in particular is always very clear and comes from a pragmatic perspective that i appreciate.
- bjoli 7y agoIn the video with Matthew Flatt he talks about continuations by building a continuation based web server. That nicely illustrates the problem of full continuation capture. It is pretty easy to understand why racket and guile went for delimited continuatiins.