diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs index b5c3d37..9294560 100644 --- a/src/interpreter/mod.rs +++ b/src/interpreter/mod.rs @@ -4,7 +4,7 @@ //! 1. (Britain) To do a clumsy or inelegant job, usually as a temporary repair; mend, patch up, repair. //! 2. To work green wood using traditional country methods; to perform the craft of a bodger. //! -//! A simple tree-walk interpreter intended for testing purposes. -//! To be replaced by VM soon™️ :ferrisClueless: +//! A simple silly compiler + VM intended for testing purposes. +//! To be replaced by something better soon™️ :ferrisClueless: pub mod value; diff --git a/src/interpreter/value/mod.rs b/src/interpreter/value/mod.rs index 83b726f..fb5ffb0 100644 --- a/src/interpreter/value/mod.rs +++ b/src/interpreter/value/mod.rs @@ -23,9 +23,9 @@ pub enum Value<'s> { Keyword(Str<'s>), Number(OrderedF64), String(Str<'s>), - Function(Function<'s>), + Function(Rc>), NativeFun(fn(&'s [Value<'s>]) -> Value<'s>), - Macro(Function<'s>), + Macro(Rc>), } impl<'s> From>> for Value<'s> { diff --git a/src/interpreter/value/string.rs b/src/interpreter/value/string.rs index a5b10fe..c759823 100644 --- a/src/interpreter/value/string.rs +++ b/src/interpreter/value/string.rs @@ -1,4 +1,4 @@ -use std::{fmt::Display, ops::Deref, rc::Rc}; +use std::{fmt::Display, ops::Deref, rc::Rc, hash::Hash}; /// A Wisp string type which can hold two variants: /// - Borrowed (usually a reference to source code or built-in literal) @@ -40,6 +40,12 @@ impl<'a> PartialEq for Str<'a> { impl<'a> Eq for Str<'a> {} +impl<'a> Hash for Str<'a> { + fn hash(&self, state: &mut H) { + (**self).hash(state); + } +} + impl<'a> Display for Str<'a> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self {