refactor objects
Some checks failed
Publish Image / publish (push) Waiting to run
Test / build (push) Waiting to run
Build / build (push) Has been cancelled

This commit is contained in:
2024-04-01 17:34:10 -04:00
parent 803f330e82
commit 99f7553d67
15 changed files with 101 additions and 94 deletions

View File

@@ -54,17 +54,14 @@ func (t Type) String() string {
}
}
// Comparable is the interface for comparing two Object and their underlying
// values. It is the responsibility of the caller (left) to check for types.
// Returns `true` iif the types and values are identical, `false` otherwise.
// Comparable is the interface for objects to implement suitable comparisons
type Comparable interface {
Compare(other Object) int
}
// Immutable is the interface for all immutable objects which must implement
// the Clone() method used by binding names to values.
type Immutable interface {
Clone() Object
// Copyable is the interface for creating copies of objects
type Copyable interface {
Copy() Object
}
// Object represents a value and implementations are expected to implement
@@ -76,10 +73,9 @@ type Object interface {
Inspect() string
}
// Hashable is the interface for all hashable objects which must implement
// the HashKey() method which returns a HashKey result.
type Hashable interface {
HashKey() HashKey
// Hasher is the interface for objects to provide suitable hash keys
type Hasher interface {
Hash() HashKey
}
// BuiltinFunction represents the builtin function type