Source status: no status is stated in the source document, so none is assigned here. Do not treat this page as a finalized specification. The normative rules are in the Technical Specification.
Function Design¶
Every function must explicitly declare its contract.
Required Declarations¶
- Inputs: What information the function accepts, including data types and constraints.
- Outputs: What the function can return.
- Preconditions: What must be true before execution.
- Postconditions: What must be true after successful execution.
- Side Effects: What external state the function is allowed to modify.
- Failure Conditions: What can cause the function to fail and how those failures are reported.
Function Rules¶
- Functions cannot silently modify undeclared external state.
- All possible outcomes must be accounted for.
- Preconditions must be checked or established by the caller.
- Successful execution must satisfy the declared postconditions.
- Guarantees must be distinguishable from assumptions.
- The compiler must reject functions with incomplete required declarations.
Design Goal¶
An AI agent should be able to understand exactly what a function expects, what it is allowed to do, and what it promises to accomplish before implementing it.
Source and authority¶
This page migrates FUNCTIONS.md in full. It is an explanatory / implementation document, not the normative specification. Where it simplifies a rule, the Technical Specification governs. The original file is preserved in source-original/LANG/.