Skip to content

react/suspend should be implemented with stop-facet #28

@tonyg

Description

@tonyg

At present, there is a lot of special-purpose machinery around react/suspend to schedule the suspended continuation when it is invoked, ensure termination of the created facet, prevent multiple invocations of the continuation (!!?!?!) etc. I think it might be a lot simpler if instead we implemented it so that invoking the wrapped continuation just calls stop-facet on the created facet, with a call to the raw continuation inside the stop-facet. That should Do The Right Thing, given that stop-facet already transplants execution to the parent of the facet-being-terminated.

Something like this:

E[(react/suspend (k) P)] ==>
(let ((the-facet (current-facet-id)))
  (react (let ((k (lambda (v) (stop-facet the-facet E[v])))) P)))

The until macro would need to be adjusted to match, to say (on E (continue (void))) instead of the current (stop-when E (continue (void))).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions