Skip to main content
This is the Draft 0.1 language specification. Its conformance requirements include targets beyond the current implementation, such as complete static typing and resource bounds. The execution contracts describe the guarantees implemented today.

Machine

A machine is a labeled record: M=⟨name=N,constants=C,fields=F,commands=D,view=V,complete=P,close=K,capabilities=A⟩M = \left\langle \begin{array}{rcl} \mathit{name} & = & N, \\ \mathit{constants} & = & C, \\ \mathit{fields} & = & F, \\ \mathit{commands} & = & D, \\ \mathit{view} & = & V, \\ \mathit{complete} & = & P, \\ \mathit{close} & = & K, \\ \mathit{capabilities} & = & A \end{array} \right\rangle The symbols name the following components:
  • NN is the diagnostic machine name and MUST NOT affect behavior.
  • CC is an immutable finite map of constants. Its values MUST be serializable DSL values.
  • FF is a finite map from field names to (type, initial-expression).
  • DD is a finite map from command names to command definitions.
  • VV is a finite map from public result names to expressions.
  • PP is an optional Boolean completion predicate.
  • KK is an ordered finite sequence of close effects.
  • AA is the manifest of exact registered algorithm names and versions.
The labeled form is normative. Implementations MAY use a class, dictionary, or other representation, but field order MUST NOT affect machine semantics.

Worked example: the activity-poll machine

For the activity poll, the labeled machine components are approximately: N=ActivityPoll,C={activities↦[bike ride,sailing,hike,beach day]},F={votes↦(Map⁡[Text⁡,Activity⁡],{})},D={vote↦the vote command definition},V={votes↦field⁡(votes),voteCount↦∣field⁡(votes)∣},P=null,K=[ ],A={}\begin{array}{rcl} N &=& \text{ActivityPoll}, \\ C &=& \{\mathit{activities} \mapsto [\text{bike ride},\text{sailing},\text{hike},\text{beach day}]\}, \\ F &=& \{\mathit{votes} \mapsto (\operatorname{Map}[\operatorname{Text},\operatorname{Activity}],\{\})\}, \\ D &=& \{\mathit{vote} \mapsto \text{the vote command definition}\}, \\ V &=& \{\mathit{votes} \mapsto \operatorname{field}(\mathit{votes}), \mathit{voteCount} \mapsto |\operatorname{field}(\mathit{votes})|\}, \\ P &=& \mathrm{null}, \\ K &=& [\,], \\ A &=& \{\} \end{array} The poll has no completion predicate, close effects, or registered algorithms. Those empty components remain part of the machine shape, making serialization and validation uniform across simple and complex machines.

Values

DSL values are:
NaN and positive or negative infinity are not valid numbers. Implementations MUST enforce configured limits on nesting, string length, collection length, and serialized size.

State

A state is a finite map containing exactly the machine’s declared fields. A state is valid when every field value recursively satisfies its declared type. The initial state is obtained by evaluating field initial expressions in field declaration order. An initial expression MAY read constants and previously initialized fields. It MUST NOT read inputs, viewer context, or lexical locals. For the poll: S0={votes↦{}}S_0 = \{\mathit{votes} \mapsto \{\}\} After Amina’s first accepted vote, a later snapshot may be: S1={votes↦{Amina↦hike}}S_1 = \{\mathit{votes} \mapsto \{\text{Amina} \mapsto \text{hike}\}\}

SharedState and scope

A SharedState space is a finite map from machine names to machine instances: Space=Map⁡ ⁣[MachineName,(MachineDefinition,MachineState)]\mathit{Space} = \operatorname{Map}\!\left[ \mathit{MachineName}, (\mathit{MachineDefinition}, \mathit{MachineState}) \right] A SharedStateMap is a map from scope keys to spaces: SharedStateMap=Map⁡[ScopeKey,Space]\mathit{SharedStateMap} = \operatorname{Map}[\mathit{ScopeKey}, \mathit{Space}] Selecting an absent scope MAY create a space from the map’s declared initial definition. Scope creation MUST be atomic and deterministic. Machines in different scopes have no implicit access to each other’s state. Machines in one space also have no cross-machine access unless an explicit, typed capability is introduced by a future DSL version.

Snapshot and event identifiers

Every committed state version has an immutable snapshot ID. Every attempted command and explicit read has a globally unique event ID. Identifiers MUST NOT be reused, even when a command produces no state change. The identifier representation is implementation-defined; equality and durable serialization are required.