Module quantity
Description
Two-layer unit system for compile-time and dynamic quantities.
The soundness boundary is closed by three rules:
- Units inside Eqiora Language are always static. The typeck layer
resolves user-declared units to dimensions;
DynQuantitynever appears inside the language. - Dynamic dimensions enter only at external boundaries (CSV import,
experiment streams, foreign APIs) and are promoted into the static
layer exclusively through
DynQuantity::checked_cast. - Demotion is always safe, promotion is always checked.
Quantity::into_dynis infallible; the reverse returnsResult. No implicit conversion exists in either direction.
Consequence: code that passes static unit checking cannot raise a
dimension error at runtime, and every place where unit soundness could
break is greppable as a checked_cast call site.
Type-level dimension arithmetic (e.g. Velocity * Time = Length in the
static layer) is deliberately deferred until adt_const_params
stabilizes; the dynamic layer already implements it. Migrating later must
not change the meaning of any public API.
Modules§
Structs§
- DimExponents
- SI base-dimension exponents.
- DynQuantity
- Runtime-dimensioned quantity — exists only at external-data boundaries (rule 2). Never appears inside Eqiora Language semantics.
- Quantity
- Statically dimensioned quantity — the only representation of physical values inside the platform (rule 1).