Skip to content
Playground(another site)

bynk.agent.construction_arity

Error An agent was constructed with the wrong number of key arguments.

An agent is addressed by its key, so constructing one takes exactly one argument: the value of its single key field. Counter("a") names the instance with key "a". Two arguments or none do not say which instance is meant. Pass the one key. A key of the wrong type is bynk.agent.key_mismatch.

Example

agent Counter {
key id: String
store n: Cell[Int]
on call get() -> Effect[Int] {
n
}
}
let v <- Counter("a", "b").get() // ✗ one key, two arguments
let v <- Counter("a").get() // ✓ one key

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.construction_arity shows the same from the installed toolchain, without a network.