src.elv.sh@v0.21.0-dev.0.20240515223629-06979efb9a2a/pkg/eval/callable.go (about)

     1  package eval
     2  
     3  import (
     4  	"reflect"
     5  
     6  	"src.elv.sh/pkg/eval/vals"
     7  )
     8  
     9  // Callable wraps the Call method.
    10  type Callable interface {
    11  	// Call calls the receiver in a Frame with arguments and options.
    12  	Call(fm *Frame, args []any, opts map[string]any) error
    13  }
    14  
    15  var (
    16  	// NoArgs is an empty argument list. It can be used as an argument to Call.
    17  	NoArgs = []any{}
    18  	// NoOpts is an empty option map. It can be used as an argument to Call.
    19  	NoOpts = map[string]any{}
    20  )
    21  
    22  func init() {
    23  	vals.CallableType = reflect.TypeOf((*Callable)(nil)).Elem()
    24  }