Skip to main content

Module value

Module value 

Source
Expand description

The recursive wire value model.

Canonical scalar encoding (used everywhere, including nested arrays and records):

{"kind":"integer","value":"9007199254740993"}
{"kind":"decimal","value":"0.10"}
{"kind":"rational","numerator":"1","denominator":"3"}
{"kind":"float64","value":"0.3333333333333333"}

Structured values:

{"kind":"quantity","value":{"kind":"decimal","value":"9.81"},"dimension":{"length":1,"time":-2}}
{"kind":"money","amount":{"kind":"decimal","value":"10.00"},"currency":"USD"}
{"kind":"matrix","rows":2,"cols":2,"data":[...]}
{"kind":"bound","unbounded":true}

Plain JSON objects are records. To keep the encoding unambiguous, record keys must not be the reserved key "kind"; validation rejects such records. Plain JSON integers and decimal numbers are interpreted as exact integers and decimals. float64 is only produced by an explicit canonical value.

Structs§

Dimension
SI-style dimension vector. Angle is tracked separately from the seven SI base dimensions so trigonometric functions can require angle/dimensionless inputs explicitly.

Enums§

Bound
A tagged confidence-bound endpoint. A mathematically unbounded endpoint is represented as Bound::Unbounded, never as a float infinity.
Value
The recursive wire value.

Constants§

DIMENSION_NAMES
DIM_AMOUNT
DIM_ANGLE
DIM_CURRENT
DIM_LENGTH
DIM_LUMINOUS
DIM_MASS
DIM_TEMPERATURE
DIM_TIME
RESERVED_KIND_KEY
Reserved key that distinguishes tagged values from records.

Functions§

validate_currency
Validate a currency identifier: 2-12 uppercase letters/digits, starting with a letter. Nonstandard units may be used but must be explicit.