-
Notifications
You must be signed in to change notification settings - Fork 988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Offer a primitive for delimited continuations #746
Comments
Chez Scheme does offer enough to implement delimited continuations. Racket has a wide variety of delimited operators, all implemented on top of Chez internals. See the implementation here: https://github.com/racket/racket/blob/master/racket/src/cs/rumble/control.ss |
The Racket implementation uses a few |
I know of Racket's implementation and studied it before I wrote my SRFI 226 (which, to a large extent, makes Racket's control features available to other Schemes). The sample implementation of SRFI 226 is also based on what is currently available in Chez Scheme. However, as much as Racket's implementation, it cannot export the host's The situation is analogous to R4RS, which has As long as I can control all the code in my program, all of this is not a problem (replacing In Racket, I can do this because the Thus, delimited continuations need to go into the core of Chez Scheme so that the versions of I believe that delimited continuations would be the most important single addition to a future Scheme standard. While Scheme has always been at the head when it comes to representing control in programming languages, since the advent of algebraic effect handlers, other languages have taken over. It would be an investment into the future if Chez Scheme supported some form of delimited continuations as Racket and Guile, for example, already do. |
Besides incompatibility with the host Thus, delimited continuations really have to be offered by the Chez Scheme core to be useful for R6RS+/ChezScheme users. As Racket's implementation would still need the primitives that are currently provided by Chez Scheme, I wonder whether the best course of action is to integrate the non-Racket specific parts of https://github.com/racket/racket/blob/master/racket/src/cs/rumble/control.ss in Chez Scheme so that both Racket and R6RS+/ChezScheme programs can make use of it. |
A new draft of my SRFI 248: Minimal delimited continuations has been published. Would you accept pull requests that would implement the procedures and syntax in the Alternatively, would the Racket team be move enough of Racket's/Rumble's |
For many applications, delimited continuations and not undelimited ones (which can be captured by
call/cc
) are needed. They are also the basis for algebraic effect handlers, which have become very popular in recent functional programming.While delimited continuations can be implemented via mutable global state and the host's
call/cc
(see [1], for example), the result would not play along well with the host'scall/cc
(because of the mutable global state) and the host'sdynamic-wind
, so new user-facing versions would have to be exposed. This can only happen on the level of standard libraries (which implicitly usecall/cc
ordynamic-wind
, e.g. in theguard
macro), though, so delimited continuations can effectively not be implemented portably.Thus, I would like to see some primitive form in Chez's library that gives access to delimited continuations and that plays along well with the other standard procedures (including the versions of
call/cc
anddynamic-wind
exposed to the user.In SRFI 248 I propose a minimal API for delimited continuations that is compatible with other (larger) APIs in the sense that they can express each other portably. I'd love to hear your comments on this SRFI, which is still in draft status.
It would be great if Chez supported a primitive on that SRFI 248 can be implemented; one way for this would be that Chez just offers SRFI 248 support in its
(chezscheme)
library. I would not shy away from some work needed to implement this if there is some consent about the ideas.--
[1] A Monadic Framework for Delimited Continuations
The text was updated successfully, but these errors were encountered: