[{"data":1,"prerenderedAt":93},["ShallowReactive",2],{"\u002Ftlt-2006.04.18-sinking-into-ocaml-continuations-madness":3},{"id":4,"title":5,"body":6,"createdAt":79,"description":80,"draft":81,"extension":82,"image":83,"mastodonThread":83,"meta":84,"navigation":85,"path":86,"seo":87,"stem":88,"tags":89,"updatedAt":91,"__hash__":92},"content\u002FTLT - 2006.04.18 - Sinking Into OCaml Continuations Madness.md","TLT_-_2006.04.18_-_Sinking_Into_OCaml_Continuations_Madness",{"type":7,"value":8,"toc":75},"minimark",[9,26,29,50,69,72],[10,11,12,13,20,21,25],"p",{},"A while back it was announced on the OCaml mailing list that someone had created a ",[14,15,19],"a",{"href":16,"rel":17},"http:\u002F\u002Fokmij.org\u002Fftp\u002FComputation\u002FContinuations.html#caml-shift",[18],"nofollow","userland delimited continuations"," library for ",[14,22,24],{"href":23},"\u002Focaml","OCaml",". I love OCaml, and I love Continuations... so I thought I'd give it a try. Ultimately going for the HTTP re-inversion trick, of course.",[10,27,28],{},"Little did I know what sort of a rabbit hole I was going down with Delimited Continuations. On the surface it doesn't seem that that big of a deal -- they're a lot like \"normal\" continuations (using call\u002Fcc or whatnot), except better. Instead of secretly being a function invocation that never returns, they are secretly a continuation that does.",[10,30,31,32,37,38,43,44,49],{},"At least that's what I've told myself. Unfortunately my brain doesn't like the explanations I've come across so far. It makes perfect sense when I stand back a bit, but once I start trying to pound this keyboard to produce some code nothing seems to make sense. The best introduction I found so far is a ",[14,33,36],{"href":34,"rel":35},"http:\u002F\u002Fcommunity.schemewiki.org\u002F?composable-continuations-tutorial",[18],"composable continuations tutorial"," on the ",[14,39,42],{"href":40,"rel":41},"http:\u002F\u002Fcommunity.schemewiki.org\u002F",[18],"Community Scheme Wiki",". Some heavier readings (such as ",[14,45,48],{"href":46,"rel":47},"http:\u002F\u002Fwww.cs.indiana.edu\u002Fcgi-bin\u002Ftechreports\u002FTRNNN.cgi?trnum=TR615",[18],"A Monadic Framework for Delimited Continuations",", on which the OCaml library is based) are a bit too fast-paced. Individual sentences are fine... but taken as a whole I'm not getting it.",[10,51,52,53,58,59,63,64,68],{},"Part of the problem is that when building ",[14,54,57],{"href":55,"rel":56},"http:\u002F\u002Fcontinuity.tlt42.org\u002F",[18],"Continuity"," (or its predecessor, ",[14,60,62],{"href":61},"\u002Fcontize","Contize","), I have actually been using coroutines rather than continuations, which simplify the situation a bit. So I haven't had to ",[65,66,67],"i",{},"really"," deal with scheme's call\u002Fcc, let alone the various delimited versions such as shift\u002Freset.",[10,70,71],{},"If it seems to you that I'm talking gibberish, perhaps you feel my pain.",[10,73,74],{},"I am making a bit of progress though. With the above tutorial and a few other searches the concepts are slowly starting to sink in. Eventually I will be able to explain it all through lovely diagrams of call-stack manipulations. Basically that's all these texts are missing -- nice simple diagrams.",{"title":76,"searchDepth":77,"depth":77,"links":78},"",2,[],"2006-04-18T16:18-04:00","A while back it was announced on the OCaml mailing list that someone had created a userland delimited continuations library for OCaml. I love OCaml, and I love Continuations... so I thought I'd give it a try. Ultimately going for the HTTP re-inversion trick, of course.",false,"md",null,{},true,"\u002Ftlt-2006.04.18-sinking-into-ocaml-continuations-madness",{"title":5,"description":80},"TLT - 2006.04.18 - Sinking Into OCaml Continuations Madness",[90],"blog","2006-04-18T16:20-04:00","cV_IVtk1YeEhhRoV3TuKO25zmS-M7fZrE6djgo6p_4E",1789166548241]