pub enum Type {
}Expand description
Types in idea9 — single-char base types, composable
Variants§
Number
Text
Bool
Any
Optional(Box<Type>)
List(Box<Type>)
Map(Box<Type>, Box<Type>)
Result(Box<Type>, Box<Type>)
Sum(Vec<String>)
Fn(Vec<Type>, Box<Type>)
Named(String)
U32
32-bit unsigned integer type. Stored as f64 in the tree-walker engine. Precision is exact for integers ≤ 2^32 (≤ 4 294 967 295).
U64
64-bit unsigned integer type. Stored as f64 in the tree-walker engine. PRECISION LIMIT: f64 has 53 mantissa bits, so values > 2^53 lose precision.
I64
64-bit signed integer type. Stored as f64 in the tree-walker engine. PRECISION LIMIT: f64 has 53 mantissa bits, so values outside ±2^53 lose precision.
Implementations§
Source§impl Type
Cycle-capability classifier for runtime values of a given static type.
impl Type
Cycle-capability classifier for runtime values of a given static type.
Background: ilo’s runtime is reference-counted (Arc in the tree
interpreter, custom RC on HeapObj in the VM). Pure RC cannot reclaim
reference cycles (A -> B -> A). Most RC languages pair RC with a cycle
collector to handle this. ilo deliberately does NOT — the surface
language is structurally cycle-free:
- Records are immutable after construction.
withallocates a fresh record; there is no field-assignment expression. Fields are bound from already-evaluated values, so a field cannot refer forward to the record being built. - Lists and maps are persistent. Mutation goes through copy-on-share
(
Arc::make_mut, freshHeapObjallocation). You cannot install a reference back to a holder you no longer have a write handle to. - Closures capture by value.
- Numbers, booleans, text, sums-of-strings, nil are inline / immutable.
This classifier exists as a foundation. It defines the invariant explicitly and gives us a regression surface if a future language change quietly introduces a cycle-forming construct. It is also the hook a future cycle collector would consult to prune immutable types.
Default policy: when in doubt, return true (cycle-capable). It is
always sound to mark a type cycle-capable; the cost is unnecessary
scanning. The unsound case is the reverse: marking a cycle-capable
type clean would let a real cycle leak forever.
Sourcepub fn can_form_cycle<F>(&self, resolve_record: &F) -> bool
pub fn can_form_cycle<F>(&self, resolve_record: &F) -> bool
Returns true if a runtime value of this type could possibly participate in a reference cycle under ilo’s current memory model.
resolve_record resolves a record type name to its field types.
Pass &|_| None to treat all Named references conservatively
(cycle-capable).