pub enum Value {
Show 17 variants
Empty,
Int(isize),
Float(f64),
Bool(bool),
Char(char),
String(Interned<'static, str>),
Ref(Place),
Slice(Place, usize),
Array(Box<[ConValue]>),
Tuple(Box<[ConValue]>),
Struct(Box<(Interned<'static, str>, HashMap<Interned<'static, str>, ConValue>)>),
TupleStruct(Box<(&'static str, Box<[ConValue]>)>),
Module(Box<HashMap<Interned<'static, str>, Option<ConValue>>>),
Quote(Box<Expr>),
Function(Rc<Function>),
Closure(Rc<Closure>),
Builtin(&'static Builtin),
}
Expand description
A Conlang value stores data in the interpreter
Variants§
Empty
The empty/unit ()
type
Int(isize)
An integer
Float(f64)
A floating point number
Bool(bool)
A boolean
Char(char)
A unicode character
String(Interned<'static, str>)
A string
Ref(Place)
A reference
Slice(Place, usize)
A reference to an array
Array(Box<[ConValue]>)
An Array
Tuple(Box<[ConValue]>)
A tuple
Struct(Box<(Interned<'static, str>, HashMap<Interned<'static, str>, ConValue>)>)
A value of a product type
TupleStruct(Box<(&'static str, Box<[ConValue]>)>)
A value of a product type with anonymous members
Module(Box<HashMap<Interned<'static, str>, Option<ConValue>>>)
An entire namespace
Quote(Box<Expr>)
A quoted expression
Function(Rc<Function>)
A callable thing
Closure(Rc<Closure>)
A closure, capturing by reference
Builtin(&'static Builtin)
A built-in function
Implementations§
Source§impl ConValue
impl ConValue
pub fn TupleStruct( name: Interned<'static, str>, values: Box<[ConValue]>, ) -> ConValue
pub fn Struct( name: Interned<'static, str>, values: HashMap<Interned<'static, str>, ConValue>, ) -> ConValue
pub fn index( &self, index: &ConValue, env: &Environment, ) -> Result<ConValue, Error>
Sourcepub fn lt(&self, other: &ConValue) -> Result<ConValue, Error>
pub fn lt(&self, other: &ConValue) -> Result<ConValue, Error>
TODO: Remove when functions are implemented: Desugar into function calls
Sourcepub fn lt_eq(&self, other: &ConValue) -> Result<ConValue, Error>
pub fn lt_eq(&self, other: &ConValue) -> Result<ConValue, Error>
TODO: Remove when functions are implemented: Desugar into function calls
Sourcepub fn eq(&self, other: &ConValue) -> Result<ConValue, Error>
pub fn eq(&self, other: &ConValue) -> Result<ConValue, Error>
TODO: Remove when functions are implemented: Desugar into function calls
Sourcepub fn neq(&self, other: &ConValue) -> Result<ConValue, Error>
pub fn neq(&self, other: &ConValue) -> Result<ConValue, Error>
TODO: Remove when functions are implemented: Desugar into function calls
Sourcepub fn gt_eq(&self, other: &ConValue) -> Result<ConValue, Error>
pub fn gt_eq(&self, other: &ConValue) -> Result<ConValue, Error>
TODO: Remove when functions are implemented: Desugar into function calls
Sourcepub fn gt(&self, other: &ConValue) -> Result<ConValue, Error>
pub fn gt(&self, other: &ConValue) -> Result<ConValue, Error>
TODO: Remove when functions are implemented: Desugar into function calls