Skip to content
Playground(another site)

bynk.detach.store_op

Error A detach targets an agent store operation, which is part of the handler's atomic commit and cannot be detached.

In an agent handler, a store write is not work to detach: it is staged and committed atomically with the rest of the handler, so there is nothing to leave running. detach is refused there for any effect, and a store operation gets its own code to point at the fix. Drop the .detach() and write do field.op(…); the write is committed with the handler. For a detach that is not of a store operation see bynk.detach.in_agent_handler.

Example

on call bump() -> Effect[()] {
do count.update((n) => n + 1).detach() // ✗ a store write is not detached
}
on call bump() -> Effect[()] {
do count.update((n) => n + 1) // ✓ staged, committed with the handler
}

In the Book

See also

  • The grammar rule it governs: method_call.
  • Every code in its category, Other, on the diagnostic index.
  • bynk explain bynk.detach.store_op shows the same from the installed toolchain, without a network.