 
 final class Environment {
     
+    var enclosing: Environment?
+    
     // Any is optional because uninitialized variables are nil.
     private var values = Dictionary<String, Any?>()
+    
+    init() {
+        self.enclosing = nil
+    }
+    
+    init(enclosing: Environment) {
+        self.enclosing = enclosing
+    }
     
     func define(name: String, value: Any?) {
 //        assert(value is Result) // compiler segmentation fault

            return values[name.lexeme]!
        }
        
        throw InterpreterError.runtime(name, "Undefined variable '\(name.lexeme)'.")
    }
    

            return
        }
        
        if let enclosing = enclosing {
            try enclosing.assign(name: name, value: value)
        }
        
        throw InterpreterError.runtime(name, "Undefined variable '\(name.lexeme)'.")
    }
}
