FunctionBinding provides the implementation of a variadic overload. The provided function is protected by a runtime type-guard which ensures runtime type agreement between the overload signature and runtime argument types.
(binding functions.FunctionOp)
| 947 | // FunctionBinding provides the implementation of a variadic overload. The provided function is protected by a runtime |
| 948 | // type-guard which ensures runtime type agreement between the overload signature and runtime argument types. |
| 949 | func FunctionBinding(binding functions.FunctionOp) OverloadOpt { |
| 950 | return func(o *OverloadDecl) (*OverloadDecl, error) { |
| 951 | if o.HasBinding() { |
| 952 | return nil, fmt.Errorf("overload already has a binding: %s", o.ID()) |
| 953 | } |
| 954 | if o.hasLateBinding { |
| 955 | return nil, fmt.Errorf("overload already has a late binding: %s", o.ID()) |
| 956 | } |
| 957 | o.functionOp = binding |
| 958 | return o, nil |
| 959 | } |
| 960 | } |
| 961 | |
| 962 | // AsyncBinding provides the implementation of an asynchronous overload. The provided function |
| 963 | // is called in its own goroutine with the provided context. The function should block until |