aboutsummaryrefslogtreecommitdiff
path: root/object
diff options
context:
space:
mode:
Diffstat (limited to 'object')
-rw-r--r--object/environment.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/object/environment.go b/object/environment.go
new file mode 100644
index 0000000..4b37749
--- /dev/null
+++ b/object/environment.go
@@ -0,0 +1,20 @@
+package object
+
+func NewEnvironment() *Environment {
+ s := make(map[string]Object)
+ return &Environment{store: s}
+}
+
+type Environment struct {
+ store map[string]Object
+}
+
+func (e *Environment) Get(name string) (Object, bool) {
+ obj, ok := e.store[name]
+ return obj, ok
+}
+
+func (e *Environment) Set(name string, val Object) Object {
+ e.store[name] = val
+ return val
+}