Skip to content
Playground(another site)

bynk.agent.outside_context

Error An agent was declared outside a context.

An agent holds state, and a context is the unit that owns it. A commons is code shared between contexts, which each uses it, so it is not given an agent, a service, an actor or a capability: those are only allowed in a context. Declare the agent in a context. A type the agent and other contexts both need can stay in the commons.

Example

commons shop
agent Counter { … } // ✗ a commons has no state
context shop
agent Counter { … } // ✓ a context owns it

In the Book

See also

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