Documentation ¶
Overview ¶
The compiler package provides a compiler and Go runtime for a subset of the Flux language. Only pure functions are supported by the compiler. A function is compiled and then may be called repeatedly with different arguments. The function must be pure meaning it has no side effects. Other language features are not supported.
This runtime is not portable by design. The runtime consists of Go types that have been constructed based on the Flux function being compiled. Those types are not serializable and cannot be transported to other systems or environments. This design is intended to limit the scope under which compilation must be supported.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompilationCache ¶
type CompilationCache struct {
// contains filtered or unexported fields
}
CompilationCache caches compilation results based on the type of the function.
func NewCompilationCache ¶
func NewCompilationCache(fn *semantic.FunctionExpression, scope Scope) *CompilationCache
type Func ¶
type Func interface { FunctionSignature() semantic.FunctionSignature Type() semantic.Type Eval(ctx context.Context, input values.Object) (values.Value, error) }
func CompileFnParam ¶
func CompileFnParam(fn *semantic.FunctionExpression, scope Scope, paramType, returnType semantic.Type) (Func, string, error)
CompileFnParam is a utility function for compiling an `fn` parameter for rename or drop/keep. In addition to the function expression, it takes two types to verify the result against: a single argument type, and a single return type.