On Thu, Jun 25, 2026 at 8:57 AM Seth via Boost <boost@lists.boost.org> wrote:
I do not think that the stated requirements on a completion handler imply the Capy simple invariant as stated plainly. ... https://godbolt.org/z/r17Kxbrdr
Ha! Nice one :) Let's pick it apart: co_await post(bind_executor(strand, deferred)) This isn't a plain awaitable being co_awaited. You are using deferred to hop executors. On the surface it looks like what you said. But look at what's actually happening here, the coroutine's execution context is broken down, moved into a completion handler, and then it is submitted to the bound executor, the strand. That's not a lightweight "executor switch." That is launching new work on the strand that coincidentally is "resume an existing coroutine." Capy does not come with a mechanism to change executors in the middle of the coroutine, and this is on purpose. It leads to code that is complicated and difficult to reason about. We prefer that the unit of execution is the coroutine, not a scope within a larger function. Nothing stops you from implementing this machinery yourself of course. Thanks