Skip to content
Playground(another site)

bynk.capability.outside_context

Error A capability was declared outside a context.

A capability is a typed interface to the outside world: a context declares it, provides it and asks for it in given, and the compiler wires the provider to the services that need it. A commons holds only pure declarations, so it cannot declare one. Move the capability into the context that uses it, or, for one several contexts share, into a context that exports it.

Example

commons demo
capability Logger { // ✗ a commons cannot declare a capability
fn log(message: String) -> Effect[()]
}
context demo
capability Logger { // ✓ a context can
fn log(message: String) -> Effect[()]
}

In the Book

See also

  • The grammar rule it governs: capability_decl.
  • Every code in its category, Capabilities, on the diagnostic index.
  • bynk explain bynk.capability.outside_context shows the same from the installed toolchain, without a network.