Skip to content

Behavior

Robert de Forest edited this page Jan 28, 2019 · 1 revision

A behavior is a container for locally trusted code.

A Behavior has

  • a descriptive name
  • source code
  • an interpreter
  • inputs
  • state
  • outputs

A Behavior may have any number of bindings which route messages sent to an object to the behavior which handles them.

Input description

An input has

  • a name
  • an optional default value

State description

State is associated with a context. A context is anything which can be uniquely identified. A "this" or "self" parameter is a likely context, but there is no limit to how many different contexts a behavior references.

A state has

  • a name
  • a context which is one of
    • local, which is reset to 'undefined' each time the behavior is invoked
    • arg(paramName), which is initialized to the value associated with this function and the nth' argument in the current invocation
    • someObject(o), which is initialized to a value associated with this function and o
  • A sharing

The values of all non-local variables are saved atomically to their contexts at the conclusion of the behavior and become visible to other invocations of that behavior then.

To simulate a 'static' function variable, use the function itself as the someObject() referent.

Output description

A behavior may have zero or more output channels. In practice they take the form of callbacks, zero or more of which may be invoked zero or more times per behavior execution. Output on a channel consists of zero or more parameters to the called function.

Clone this wiki locally