# D2 diagram of tvix-eval's `Value` type. # # can be rendered at https://play.d2lang.com/ # # colours have meanings: # # yellow: recurses # orange: heap allocation # red: refcount # # this intentionally does *not* include some internal variants Value -> Null Value -> Bool Value -> Integer Value -> Float Box*.style.fill: "lightsalmon" Rc*.style.fill: "salmon" Vec\<*.style.fill: "salmon" Value -> String -> NixString -> "Box<str>" Value -> Path -> "Box<PathBuf>" -> PathBuf PathBuf.style.fill: "lightsalmon" # attribute sets are kinda complicated Value -> Attrs -> "Box<NixAttrs>" -> NixAttrs NixAttrs -> Empty NixAttrs -> KV KV.style.fill: "LemonChiffon" KV -> Value KV -> Value NixAttrs -> Map Map -> "OrdMap<NixString, Value>" -> "MapEntry<NixString, Value>" "OrdMap<NixString, Value>".style.fill: "lightsalmon" "MapEntry<NixString, Value>".style.fill: "salmon" "MapEntry<NixString, Value>".style.multiple: true "MapEntry<NixString, Value>" -> NixString "MapEntry<NixString, Value>" -> Value "MapEntry<NixString, Value>".style.stroke-width: 15 "MapEntry<NixString, Value>".style.stroke: "lemonchiffon" Value -> List -> NixList -> "Rc<imbl::Vector<Value>>" "Rc<imbl::Vector<Value>>" -> "VecEntry<Value>" -> Value "VecEntry<Value>".style.multiple: true "VecEntry<Value>".style.fill: "salmon" "VecEntry<Value>".style.stroke-width: 15 "VecEntry<Value>".style.stroke: "lemonchiffon" # closures Value -> Closure -> "Rc<Closure>" -> Closure Closure -> "Rc<Lambda>" -> Lambda Lambda -> Chunk Lambda -> SmolStr: sometimes allocates SmolStr.style.fill: "lightsalmon" Lambda -> usize Lambda -> "Option<Formals>" -> Formals Formals -> "HashMap<NixString, bool>" -> "MapEntry<NixString, bool>" "HashMap<NixString, bool>".style.fill: "lightsalmon" "MapEntry<NixString, bool>".style.fill: "salmon" "MapEntry<NixString, bool>".style.multiple: true "MapEntry<NixString, bool>" -> NixString Closure -> "Rc<Upvalues>" -> Upvalues Upvalues -> "Vec<Value>" "Vec<Value>" -> Value "Vec<Value>".style.stroke-width: 15 "Vec<Value>".style.stroke: "lemonchiffon" Upvalues -> "Option<Vec<Value>>" "Option<Vec<Value>>" -> Value "Option<Vec<Value>>".style.fill: "lightsalmon" "Option<Vec<Value>>".style.stroke-width: 15 "Option<Vec<Value>>".style.stroke: "lemonchiffon" Value -> Blueprint -> "Rc<Lambda>" # builtins Value -> Builtin -> "Box<BuiltinRepr>" -> BuiltinRepr BuiltinRepr -> "Rc<dyn BuiltinGen>" BuiltinRepr -> "Vec<Value>" # thunks Value -> Thunk -> "Rc<RefCell<ThunkRepr>>" -> ThunkRepr ThunkRepr -> Suspended Suspended -> "Rc<Lambda>" Suspended -> "Rc<Upvalues>" ThunkRepr -> Native -> "Box<dyn Fn() -> Result<Value, ErrorKind>>" ThunkRepr -> Blackhole ThunkRepr -> Evaluated -> Value Evaluated.style.fill: "lemonchiffon"