Expand description
The universal Value tagged union and supporting types (Bf16, FnValue).
The universal runtime value type for the CJC interpreter.
This module defines Value, the tagged union that represents every
runtime value in both the AST interpreter (cjc-eval) and the MIR
executor (cjc-mir-exec). It also provides the Bf16 brain-float
type and FnValue for function references.
§Memory Model
- Scalars (
Int,Float,Bool,U8,Bf16,F16,Complex) are stored inline – no heap allocation. - Heap types (
String,Array,Tuple,Map,Bytes,Tensor) useRc<...>for O(1) clone with copy-on-write mutation semantics. - Type-erased objects (
GradGraph,OptimizerState,TidyView,VizorPlot,QuantumState) useRc<dyn Any>orRc<RefCell<dyn Any>>to avoid circular crate dependencies.
§NA Semantics
Value::Na is the missing-value sentinel. It propagates through
arithmetic (NA + x -> NA) and compares unequal to everything including
itself (NA == NA -> false). Test with is_na().
Structs§
- Bf16
- Brain-float 16-bit floating-point type (bf16).
- FnValue
- A CJC function value — either a named function or a closure.
Enums§
- Value
- The universal value type for the CJC interpreter.