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)
| 1032 | // FunctionBinding provides the implementation of a variadic overload. The provided function is protected by a runtime |
| 1033 | // type-guard which ensures runtime type agreement between the overload signature and runtime argument types. |
| 1034 | func FunctionBinding(binding functions.FunctionOp) OverloadOpt { |
| 1035 | return func(o *OverloadDecl) (*OverloadDecl, error) { |
| 1036 | if o.HasBinding() { |
| 1037 | return nil, fmt.Errorf("overload already has a binding: %s", o.ID()) |
| 1038 | } |
| 1039 | if o.hasLateBinding { |
| 1040 | return nil, fmt.Errorf("overload already has a late binding: %s", o.ID()) |
| 1041 | } |
| 1042 | o.functionOp = binding |
| 1043 | return o, nil |
| 1044 | } |
| 1045 | } |
| 1046 | |
| 1047 | // AsyncBinding provides the implementation of an asynchronous overload. The provided function |
| 1048 | // is called in its own goroutine with the provided context. The function should block until |