We demonstrate persistent delimited continuation library for bytecode OCaml programs. The captured delimited continuations can be stored on disk, to be later loaded and resumed in a different process. The library works with the unmodified OCaml system as it is.
We demonstrate that the library makes writing web applications (CGI scripts) as straightforward as writing interactive console applications using read and printf. The output of course can be arbitrarily complex HTML, XML, etc. In particular, our code can take advantage of regular lexical scope for (mutable) temporary data, rather than having to explicitly read and write them via a request object. The use of continuations lets us avoid loops in the code, relying instead on the `Back button.' Delimited continuations naturally support `thread-local' scope and are quite compact to serialize.
Delimited continuations help us implement nested transactions. In a live demo we show that a user may repeatedly go back-and-forth between editing and previewing their blog post, perhaps in several windows. The finished post can be submitted only once.
Kahua is a continuation passing style (CPS) application framework and server, in which we have developed and been serving several practical web applications.
From our experience we implemented number of higher-level APIs that wraps different aspects of continuations to capture the common idioms in web-application programming. Using them makes web-application development much easier than using bare call/cc and shift/reset primitives. In this presentation, we explain the implementation and usage of them, based on actual examples we encountered during the development.
Spearker's profile: Katsutoshi Itoh is a member of Kahua project since 2005.
A natural language expression can be represented as a kind of program. Any such program, if well-formed, can be evaluated in different domains such as orthography, phonology, and semantics. The resulting values are the spelling, pronunciation and meaning, respectively, of the grammatical expression of the language the program represents.
From this viewpoint, I will illustrate the use of delimited continuation in analyzing sentences in Japanese. In particular, the meaning of question words such as ï (dare) and ²¿ (nani) involve shift operator, and that of ¤â (mo) and ¤« (ka) function as reset.
Playback of encoded video involves scheduling the decoding of audio and video frames and synchronizing their playback. "Scrubbing" is the ability to quickly seek to and display an arbitrary frame, and is a common user interface requirement for a video editor. The implementation of playback and scrubbing is complicated by data dependencies in compressed video formats, which require setup and manipulation of decoder state.
We present the preliminary design of a continuation-based system for video decoding, reified as a cursor into a stream of decoded video frames. Frames are decoded lazily, and decoder states are recreated or restored when seeking. To reduce space requirements, a sequence of decoded frames can be replaced after use by the continuation which created them. We outline implementations in Haskell and C.
Programming Language Ruby has a Continuation class and a callcc method. In this presentation, we introduce history, current situation (on Ruby 1.9) and the future of Ruby's continuation.
Profile: Koichi Sasada is one of the developer of the Ruby interpreter. His Virtual Machine was merged with Ruby 1.9 which is released at Dec/2007.