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.
Environments
Expression evaluation receives five environments:- constants
C; - immutable state snapshot
S; - validated command input
I; - capability-checked execution context
X; - lexical collection locals
L.
Type judgment
Static typing is written: The type environment is the disjoint union: where the components contain types for constants, fields, command inputs, context capabilities, and lexical locals. Context entries additionally carry a disclosure label: The label is checked by the information-flow rules in Section 5 and does not change the ordinary value type . Representative rules: Map lookup without a default returns an optional value: Map lookup with a default of the map’s value type returns a non-optional value: Conditional branches are combined with the least defined type join: The required joins are: No implicit join exists for unrelated types. For example, is undefined unless a future DSL version introduces an explicitly declared union type. An undefined join is a creation-time type error; it does not silently widen toAny.
Worked example: constructing the poll’s type environment
While checking thevote command, the relevant environments include:
Here Activity is the finite choice type containing the four configured
activities. There are no lexical locals because the command does not contain a
map, filter, or similar binding expression.
The expression:
Activity, because its default is also an Activity.
A context-dependent expression illustrates the disclosure component:
Text, while its label records that it identifies the
current participant. Type checking answers “is this text?”; information-flow
checking separately answers “may this view disclose it?”
An implementation MUST recursively validate sequence element types, map key and
value types, and record fields. Top-level container checking is insufficient.
Evaluation
Pure expressions MUST NOT modify state or perform I/O. Evaluation is deterministic for identical environments and semantic versions. Arithmetic MUST reject division by zero and non-finite results. Positional access MUST reject an invalid index unless guarded by a lazy expression.Laziness
choose, Boolean and, and Boolean or are short-circuiting:
The absent branch premise is intentional: the unselected expression is not
evaluated.
Short-circuit conjunction and disjunction are:
The rules for are dual.
The unselected branch MUST NOT be evaluated. Similarly, the right operand of
and is skipped after false and the right operand of or is skipped after true.
Collection operations
Map, filter, reduction, and sorting operate only on finite collections. Their lexical locals are visible only inside their own expression body. Stable sorting MUST preserve input order among records equal under all declared sort keys. Reducers MUST define empty-collection behavior explicitly. It is an error to invoke a reducer for which the runtime lacks the exact semantic version.Expression safety
The language MUST NOT provide arbitrary callbacks, imports, evaluation of code, reflection, unrestricted object attributes, filesystem or network access, general recursion, or user-defined unbounded loops.Implemented accumulator expressions
The current interpreter also provides lexicallet, sequence fold, bounded
iterate, take, exp, and stable logsumexp expressions. Their operands and
bodies are serialized in the existing expression representation. See
Primitive examples and validation
for their operational contracts, scope rules, budget boundaries, and examples.
The iteration cap does not establish the specification’s global resource-bound
requirements or a complete static type system. Older interpreters that do not
recognize these operators must reject the definitions.
Implemented record and scope checks
StateType.record(fields, allow_extra=False) declares required named members. Optional
member types admit null, not omission; allow_extra=True permits additional
finite JSON values. Initial values, inputs, and proposed state are checked
recursively. Machine validation checks lexical scope in all expression contexts
and rejects literal lookups of undeclared members on known closed records,
including unselected branches. Failures include the machine and expression path.
These checks are a conservative subset of the type judgment described above.
The interpreter checks known operand compatibility, preserves compatible numeric
and nested-container branch shapes, and uses explicitly declared
accumulator_type/state_type invariants in loops. Seeds and each carried value
are also validated at runtime. Undeclared accumulator types remain unknown.
Unlike the full judgment above, unrelated branches currently widen to any;
null safety, dynamic lookup proofs, and complete reducer inference are not
implemented. These are implementation boundaries, not full conformance claims. See
Records and early validation
for the current contract.