pub enum Value {
Int(i64),
Float(f64),
Bool(bool),
String(SeqString),
Variant(Arc<VariantData>),
Map(Box<HashMap<MapKey, Value>>),
Quotation {
wrapper: usize,
impl_: usize,
},
Closure {
fn_ptr: usize,
env: Arc<[Value]>,
},
}Expand description
Value: What the language talks about
This is pure data with no pointers to other values. Values can be pushed on the stack, stored in variants, etc. The key insight: Value is independent of Stack structure.
Variants§
Int(i64)
Integer value
Float(f64)
Floating-point value (IEEE 754 double precision)
Bool(bool)
Boolean value
String(SeqString)
String (arena or globally allocated via SeqString)
Variant(Arc<VariantData>)
Variant (sum type with tagged fields) Uses Arc for O(1) cloning - essential for recursive data structures
Map(Box<HashMap<MapKey, Value>>)
Map (key-value dictionary with O(1) lookup) Keys must be hashable types (Int, String, Bool)
Quotation
Quotation (stateless function with two entry points for calling convention compatibility)
- wrapper: C-convention entry point for calls from the runtime
- impl_: tailcc entry point for tail calls from compiled code (enables TCO)
Fields
Closure
Closure (quotation with captured environment) Contains function pointer and Arc-shared array of captured values. Arc enables TCO: no cleanup needed after tail call, ref-count handles it.
Trait Implementations§
Source§impl ValueSerialize for Value
impl ValueSerialize for Value
Source§fn to_typed(&self) -> Result<TypedValue, SerializeError>
fn to_typed(&self) -> Result<TypedValue, SerializeError>
impl Send for Value
impl StructuralPartialEq for Value
impl Sync for Value
Auto Trait Implementations§
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)