5 ms·
re: delimited continuations i'm a big fan of 'normal' continuations, have looked at this work before, and just now tried to figure out what the win is from rea
by convolvatron 7y ago
re: delimited continuations
i'm a big fan of 'normal' continuations, have looked at this work before, and just now tried to figure out what the win is from reading wiki.
to me it seems like an complicated and unnecessary layer above call/cc.
but I think I'm just not getting something important. could you post a good reference or describe why you find them to be a compelling abstraction?
- bjoli 7y agoFull 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.