Skip to content
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

Clone continuation stacks on-demand #26

Merged
merged 1 commit into from
Dec 4, 2024
Merged

Clone continuation stacks on-demand #26

merged 1 commit into from
Dec 4, 2024

Conversation

maplant
Copy link
Owner

@maplant maplant commented Dec 4, 2024

I noticed that the classic yin-yang puzzle[1] wasn't working properly. Turns out I was forgetting to clone the stacks! That's fixed now. Because it's an expensive operation, it's only ever done at points where scheme is given access to a first-class continuation. If you have a continuation that you would like to use, be sure to run clone_stack on it.

[1]:

(let* ((yin
         ((lambda (cc) (display "@") cc) (call-with-current-continuation (lambda (c) c))))
       (yang
         ((lambda (cc) (display "*") cc) (call-with-current-continuation (lambda (c) c)))))
    (yin yang))

@maplant maplant merged commit da752f7 into main Dec 4, 2024
1 check passed
@maplant maplant deleted the clone-scopes branch December 4, 2024 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant