-
Notifications
You must be signed in to change notification settings - Fork 991
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
call-in-continuation
and immediate continuation marks
#907
Comments
That's the intended behavior. The documentation of Your example partly illustrates why it's implemented and (intended to be) defined the way it is in Chez Scheme. If a captured continuation includes immediate marks, then nested Racket makes s different choice here. Nested |
Thanks for pointing out the particular behaviour of From the way the documentation on continuation marks in the CSUG is written, I have read it in a way that the immediate continuation marks are part of the continuation that is reified by You write that That said, I think it is probably best to just leave the implementation and semantics as they are and as they have been intended. In that case, I would like to make two suggestions:
If you think 1. and 2. are a good idea, I can make a suggestion as a pull request. PS I still think that Chez should get some primitives for delimited continuations. I would be willing to implement or help to implement them, but I would like to discuss strategies/the API first. It may make sense to implement it in a way so that parts of Racket's rumble/control.ss can be moved into Chez Scheme proper. What should probably be avoided is wrapping native continuations into structures as it is done in |
I think we're mostly on the same page here, but to check:
Assuming we're on the same page that far, I don't think it helps to describe the immediate table as thread-local. Then you have o specify more machinery about how the table gets attached to extensions of the continuation as a new one is created, and so on — closer to the implementation, but less clear as a model. I grant that the behavior of I agree that there are better ways to build a delimited-continuation layer on top of Chez Scheme's existing functionality. I think the |
[...]
This makes a lot of sense to me. Changing the continuation machinery before thinking of how to potentially implement delimited continuations in Chez doesn't seem worth the effort because delimited continuations will likely need their own share of changes. What do you think of replacing (in the CSUG)
by something like
I have to fix the
The current implementation of marks in Chez does not use a HAMT either but a cache, which may have worse algorithmic complexity. Maybe we can work in steps. If delimited continuations are moved to the core of Chez, Racket does not need to use them directly but only after HAMTs have been implemented at a later step so that the situation for Racket does not worsen. Implementing HAMTs for Chez independently makes sense in my opinion because implementing them portably is problematic when the key is |
Consider the following expression:
It evaluates to
#t
, which reflects the fact that the last expression of the thunk argument tocall-in-continuation
is evaluated in the continuation of the whole expression.This, however, is not reflected by the implementation of immediate continuation marks. Consider:
This expression evaluates to
tail
, which reflects the fact thatkey
is part of the immediate table of marks of the continuation of the whole expression.Now consider:
In the current implementation of continuation marks, this evaluates to
#f
. In other words, the implementation ofcall-with-immediate-continuation-mark
fails to deliver the immediate marks of the continuation to the call of the thunk argument tocall-in-continuation
.The text was updated successfully, but these errors were encountered: