Type system
The type system specification is not yet written. It will live as a separate document from the grammar — the grammar describes how programs parse, the type system describes what they mean.
The spec will cover:
- Unit types —
Time,Length,Frequency,Angle,Tempo, and how the lexer’s units (ms,px,hz,deg,bpm,bars,beats, …) inhabit them. - Asset types —
Image,Audio,Font, opaque to the program but loadable through the stdlib. - 2D types —
Path,Layer,Frame, and the rules forcompose [...]. - 3D types —
Mesh3d,Material,Light,Camera, and the bridge from 3D back to a 2DLayerviarender3d(...). - Color — a single
Colortype inhabited by everycolor_litform (#hex,oklch(...),oklab(...),srgb(...)). Color space is part of the value, not the type, so mixing colors across spaces is allowed and well-defined. - Animation types —
Animation<T>parameterised by what’s being animated (Animation<Scale>,Animation<Color>,Animation<Angle>).animate { ... } with { ... }produces one of these. - Function types — including how
animate { ... } with { ... }and postfix method chains are typed. - Determinism partition — every stdlib function is tagged
pureoreffectful. Effectful functions take an explicit capability (file/network/clock) and cannot be called from apurecontext. This is what makes the CanvasKit backend deterministic.
Status: not started. See Roadmap stage 2.