Summary
A calculation is a pure function: no touches metadata, no await, no filesystem or network by default.
Syntax
calculation annual price
input monthly price: Int
output annual price: Int
annual price is monthly price * 12Body forms include input, output, {name} is {expr}, for each, add to / subtract from / set to, and return.
Semantics
Inputs are required at call sites. The output name defines the result binding inside the body. Calculations may call other pure calculations and use operators, literals, lists, and records.
Compiler note
Calculations are pure: the checker rejects effects and await inside the body. Callable names with spaces are normalized internally; semantic refs keep author spelling.
Example
From examples/math.point:
calculation annual price
input monthly price: Int
output annual price: Int
annual price is monthly price * 12Common mistakes
- Using
awaitor calling actions inside a calculation - Return type does not match
outputdeclaration (return-type-mismatch,type-mismatch)
Agent diagnostic notes
- Ref shape:
point://semantic/Math/calculation.annual price - Tests are calculations whose name starts with
testand returnBool(seepoint test)
