Delimited continuations in lone Lisp

(matheusmoreira.com)

107 points | by matheusmoreira 4 days ago ago

9 comments

  • alexisread 4 hours ago

    Interestingly Wat implements a callstack in a userland VM, to implement it's delimited continuations. Ergonomically it would be good to implement algebraic effects on top, but the basis is there, along with demos of exception handling, branching, fibres etc.

    https://github.com/manuel/wat-js

    Obviously with forths the callstack is already in userland to implement these things, might be a bit brain-bending in forth.

  • thdhhghgbhy 5 hours ago

    It's powerful, but is anyone actually using it other than in hobby projects that is, in any language?

    • jdpage 2 hours ago

      The Ocaml 5 effect system is based on delimited continuations, and its new effect-based IO library, Eio, seems to be getting more and more popular all the time.

    • DonaldPShimoda 4 hours ago

      By "it" do you mean delimited continuations? If so, my understanding is that they are the standard mode of interruption in Racket — all error-raising/handling and other continuation forms (call/cc, etc) are implemented in terms of delimited continuations because they're a more general abstraction than the older primitives. You can read about Racket's continuation model and where they're used in §10.4 of the Racket Reference [1].

      [1] https://docs.racket-lang.org/reference/cont.html

      • riffraff 2 hours ago

        I may be incorrect, but isn't call/cc+state equivalent to delimited continuations? I.e. one can be implemented with the other (and IIRC Racket does have state)

    • cosmic_quanta 3 hours ago

      Delimited continuations have been implemented in the de-facto standard Haskell runtime system, the GHC runtime system [0]. The goal was to make effect systems more performant [1], but I believe that work has stalled due to the maintainer shifting priorities.

      [0]: https://github.com/ghc-proposals/ghc-proposals/blob/master/p...

      [1]: https://blog.poisson.chat/posts/2023-01-02-del-cont-examples...

    • kryptiskt 4 hours ago

      Java's new green threads are built on delimited continuations.

  • aktuel 6 hours ago

    Project page says it runs on top of the kernel. What is the intended use case? Embedded?