cel-go icon indicating copy to clipboard operation
cel-go copied to clipboard

Late Function Bindings in Go Cel Evaluation

Open mswest46 opened this issue 5 years ago • 3 comments

Currently, function definitions must be provided in the parsing step, so data relevant to their definition must be available at that step. This request is to support binding a function at activation time instead. As a use case example, I'd like to write a function has_tag :: string -> bool whose implementation checks membership in a list tags that is only available at evaluation time and remains hidden from the expression writer.

mswest46 avatar May 19 '20 18:05 mswest46

We're discussing a generalization of this - allow functions to access the full Activation, not just the supplied variables. This way you could bind tags as a variable at runtime in the normal way, but it would be hidden from the expression if you omit it from the declarations at type check time. This would require a separate flavor of overload which would accept something like func(interpreter.Activation, ...ref.Val) ref.Val.

JimLarson avatar May 21 '20 22:05 JimLarson