Skip to content

Forking a continuation requires deepCopy()? #197

Description

@zevv

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions