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.
Exceptions with throw/catch are 90% of the way to delimited continuations so in a sense everyone is already using a close subset of it!
They could be useful in typical exception handling contexts where the operation could be retried. An operation involving a file read that fails due to file not being found could be body could be resumed with dummy data or data sourced from alternative locations. Lisps also like to show a REPL and allow the programmers to plug in the value themselves.
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.
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].
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)
Oleg covers this on his page "An argument against call/cc" (which is linked). The long-and-short of it is: only in a toy-like way; in practice even call/cc + state are insufficient primitives.
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.
Well the delimited continuation primops are there in ghc for anyone to use. But even with the proliferation of effects libraries in Haskell, I haven't heard a whisper of any of them using the delimited continuation primitives in ghc. There was one very expwrimental extension to Bluefin from memory, but that's it.
That's Bluefin Algae, which isn't as such an extension to Bluefin, but a library that wraps delimited continuations in a Bluefin-style API. As far as I know, no one has really used it yet.
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.
It's powerful, but is anyone actually using it other than in hobby projects that is, in any language?
Exceptions with throw/catch are 90% of the way to delimited continuations so in a sense everyone is already using a close subset of it!
They could be useful in typical exception handling contexts where the operation could be retried. An operation involving a file read that fails due to file not being found could be body could be resumed with dummy data or data sourced from alternative locations. Lisps also like to show a REPL and allow the programmers to plug in the value themselves.
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.
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
>delimited continuations?
Yes, sorry typed this up on the run.
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)
Oleg covers this on his page "An argument against call/cc" (which is linked). The long-and-short of it is: only in a toy-like way; in practice even call/cc + state are insufficient primitives.
https://okmij.org/ftp/continuations/against-callcc.html#trap...
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...
Well the delimited continuation primops are there in ghc for anyone to use. But even with the proliferation of effects libraries in Haskell, I haven't heard a whisper of any of them using the delimited continuation primitives in ghc. There was one very expwrimental extension to Bluefin from memory, but that's it.
That's Bluefin Algae, which isn't as such an extension to Bluefin, but a library that wraps delimited continuations in a Bluefin-style API. As far as I know, no one has really used it yet.
[1] https://hackage.haskell.org/package/bluefin-algae
Java's new green threads are built on delimited continuations.
Project page says it runs on top of the kernel. What is the intended use case? Embedded?