Golang user-defined functions #2498
-
Besides the builtin functions available from the cuelang package, is it possible to call Golang functions from user-defined or other standard library packages. Specifically I would like to use |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
This sort of extensibility will be covered by the WebAssembly (Wasm) work that we are doing: #2463. Such Wasm modules will then be distributed via modules (#2330). In this way, people will not be limited by the standard library of builtins that we (currently) offer. That said, there are often strong arguments for making something part of the standard library. I would suggest that (Incidentally, we also somewhat envisage a Go-like cc @4ad for more information on the Wasm side of things. |
Beta Was this translation helpful? Give feedback.
-
Thank you. I've opened a feature request here #2499 |
Beta Was this translation helpful? Give feedback.
-
Re-opening this discussion given #2498 (reply in thread) (because I keep trying to find this discussion and failing because it's closed!) |
Beta Was this translation helpful? Give feedback.
-
Tangentially related in that this should never be a native builtin - I have really, really wanted to match Kubernetes labels against a label selector (using the labels package in k8s). This would really simplify our cue-crossplane compositions by being able to conditionally set attributes based on object labels. Right now, we have to do some preprocessing elsewhere and hand the results to cue. |
Beta Was this translation helpful? Give feedback.
This sort of extensibility will be covered by the WebAssembly (Wasm) work that we are doing: #2463. Such Wasm modules will then be distributed via modules (#2330). In this way, people will not be limited by the standard library of builtins that we (currently) offer.
That said, there are often strong arguments for making something part of the standard library. I would suggest that
mail.ParseAddress
comes pretty close to passing an as-yet-undefined threshold for inclusion. Please can you raise a feature request to that end if you would like this added? It feels ok to me, but a feature request will help to confirm.(Incidentally, we also somewhat envisage a Go-like
cuelang.org/x/...
namespac…