pub enum Value {
Int(i64),
Float(f64),
Bool(bool),
String(SeqString),
Variant(Box<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(Box<VariantData>)
Variant (sum type with tagged fields)
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>
Convert to serializable TypedValue
impl Send for Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl !Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more