diff --git a/src/interpreter/environment.rs b/src/interpreter/environment.rs index c188cb3..02b552c 100644 --- a/src/interpreter/environment.rs +++ b/src/interpreter/environment.rs @@ -11,12 +11,23 @@ pub type EnvironmentRef = Rc>; pub type Variable = Option; /// The execution environment. -#[derive(Debug, Default)] +#[derive(Debug)] pub struct Environment { enclosing: Option, values: HashMap, } +impl Default for Environment { + /// Create the default global environment. This includes native functions. + fn default() -> Self { + let env = Self { + enclosing: None, + values: HashMap::new(), + }; + env + } +} + impl Environment { /// Create an environment enclosed in another. pub fn create_child(parent: &EnvironmentRef) -> EnvironmentRef {