add documentation comment on Object and Callable interface
This commit is contained in:
parent
48847c1f6d
commit
8a2784853b
2 changed files with 21 additions and 1 deletions
objects
|
@ -1,5 +1,8 @@
|
|||
package objects
|
||||
|
||||
type Callable interface {
|
||||
// Call should take an arbitrary number of arguments
|
||||
// and returns a return value and/or an error,
|
||||
// which the VM will consider as a run-time error.
|
||||
Call(args ...Object) (ret Object, err error)
|
||||
}
|
||||
|
|
|
@ -3,10 +3,27 @@ package objects
|
|||
import "github.com/d5/tengo/compiler/token"
|
||||
|
||||
type Object interface {
|
||||
// TypeName should return the name of the type.
|
||||
TypeName() string
|
||||
|
||||
// String should return a string representation of the type's value.
|
||||
String() string
|
||||
|
||||
// BinaryOp should return another object that is the result of
|
||||
// a given binary operator and a right-hand side object.
|
||||
// If BinaryOp returns an error, the VM will treat it as a run-time error.
|
||||
BinaryOp(op token.Token, rhs Object) (Object, error)
|
||||
|
||||
// IsFalsy should return true if the value of the type
|
||||
// should be considered as falsy.
|
||||
IsFalsy() bool
|
||||
Equals(Object) bool
|
||||
|
||||
// Equals should return true if the value of the type
|
||||
// should be considered as equal to the value of another object.
|
||||
Equals(another Object) bool
|
||||
|
||||
// Copy should return a copy of the type (and its value).
|
||||
// Copy function will be used for copy() builtin function
|
||||
// which is expected to deep-copy the values generally.
|
||||
Copy() Object
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue