Back to Eqiora docs Skip to main content

Module quantity

Module quantity 

Description

Two-layer unit system for compile-time and dynamic quantities.

The soundness boundary is closed by three rules:

  1. Units inside Eqiora Language are always static. The typeck layer resolves user-declared units to dimensions; DynQuantity never appears inside the language.
  2. 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.
  3. Demotion is always safe, promotion is always checked. Quantity::into_dyn is infallible; the reverse returns Result. 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§

aliases
Convenient aliases for common quantities (f64 by default).
dim
Standard dimension markers.

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).

Traits§

Dimension
Compile-time dimension marker.
Scalar
Scalar types admitted into quantities.