-
Notifications
You must be signed in to change notification settings - Fork 170
pkg/**: stdlib and builtin expansion #348
Comments
I came here to request this. I've had some recent success implementing some existing kubernetes tooling using cue. The existing tooling involves hashing, and I am unable to choose the hash function as it needs to match the existing go implementation for compatibility reasons. I've done this twice recently (currently in love with cue, thanks a lot for the hard work!): In the first case the hash function used was sha256 which is already in the cue stdlib, so I was able to complete the implementation in cue successfully. But in the second case the hash function is https://golang.org/pkg/hash/fnv/ which sadly isn't in cue's stdlib. It'd be great if you'd accept a pull request to add it (?), but more generally I'd love to able to define my own functions like this (understanding, a bit like with Bazel, that they need to be hermetic & deterministic). Thought I'd post this here as an end-user experience report in case it's helpful. .................................................. PS: Here's the kubernetes tooling I'm working with by the way: hash/fnv is used in kubernetes-sigs/cli-utils (which is used by google's new kpt tool): and here's my cue code (albeit using the wrong hash function):
|
Same comment about user defined builtins: #423 (comment) |
I have also noticed that to generate JWT in CUE is hard because there are no |
CUE is hermetic and I'm not sure secure crypto generation aligns with that goal |
Yeah, generally |
|
Of note, I just noticed tou are working in the non-hermetic area of the |
This issue has been migrated to cue-lang/cue#348. For more details about CUE's migration to a new home, please see cue-lang/cue#1078. |
Generally, we would like to see the standard library expanded.
At this point I am starting a conversation about the topic. We can change this header as things become better understood.
Thoughts:
Another thought is...
iirc, the way builtins are happened, this might not be overly difficult. There is the issue (still to be created) that fields named the same as builtin funcs are sorted before other fields in a struct.
Functions and Packages:
From Go, for
pkg/tool
From Go, for pure cue
pkg
expansionExternal, for pure cue
pkg
expansionMoonshot:
cue.Value
rather than the exported / data forms.I can see writing a cue tool which has a schema with it, and then processing local cue packages with the tool. So there may be a need to load and process other cue files from within the tool portion of a cue "program"
The text was updated successfully, but these errors were encountered: