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

Forking a continuation requires deepCopy()? #197

Open
zevv opened this issue Jul 1, 2021 · 2 comments
Open

Forking a continuation requires deepCopy()? #197

zevv opened this issue Jul 1, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@zevv
Copy link
Collaborator

zevv commented Jul 1, 2021

The move to inherited objects has made it impossible to properly fork continuations. This is what I did before:

proc fork(c: C): C {.cpsMagic.} =
  let c2 = C()
  c2[] = c[]
  c.evq.push c2
  c

This doesn't work because c2 will now be of the C root type, losing all memory of the original type and its data.
Workaround is using deepCopy(), but that'll not work on the JS backend and is disabled by default for --gc:arc

I guess there is no alternative standard way to do this?

@disruptek
Copy link
Contributor

disruptek commented Jul 2, 2021

Not yet, and it's the most critical defect missing enhancement 😏 as far as I'm concerned.

@disruptek disruptek added the enhancement New feature or request label Jul 2, 2021
@disruptek
Copy link
Contributor

This can be solved coincidentally with #190.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants