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.
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 callsstop-facet
on the created facet, with a call to the raw continuation inside the stop-facet. That should Do The Right Thing, given thatstop-facet
already transplants execution to the parent of the facet-being-terminated.Something like this:
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)))
.