diff options
Diffstat (limited to 'object/object.go')
| -rw-r--r-- | object/object.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/object/object.go b/object/object.go index 731be0b..24de9be 100644 --- a/object/object.go +++ b/object/object.go @@ -17,6 +17,7 @@ const ( FUNCTION_OBJ = "FUNCTION" STRING_OBJ = "STRING" ERROR_OBJ = "ERROR" + BUILTIN_OBJ = "BUILTIN" ) type Object interface { @@ -52,6 +53,12 @@ type String struct { Value string } +type BuiltinFunction func(args ...Object) Object + +type Builtin struct { + Fn BuiltinFunction +} + func (i *Integer) Type() ObjectType { return INTEGER_OBJ } @@ -112,3 +119,6 @@ func (e *Error) Inspect() string { return "ERROR:" + e.Message } func (s *String) Type() ObjectType { return STRING_OBJ } func (s *String) Inspect() string { return s.Value } + +func (b *Builtin) Type() ObjectType { return BUILTIN_OBJ } +func (b *Builtin) Inspect() string { return "builtin function" } |
