mirror of
https://github.com/apple/pkl.git
synced 2026-01-13 15:13:38 +01:00
binary serialization #185
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @blacktop on GitHub (Jul 17, 2024).
It would be awesome if you could add binary serialization to compact the pkl files.
I started using it in a NEW feature for one of my projects and it is creating very large files ;)
Thanks!
@bioball commented on GitHub (Jul 17, 2024):
WRT large files: are you referring to Pkl source files, or something else?
@blacktop commented on GitHub (Jul 17, 2024):
I might be using
pkls not for their intended purpose, but I've enjoying the format so far.Here is an example:
@blacktop commented on GitHub (Jul 17, 2024):
I prob can .tar.gz etc the files to make them smaller when sending around, but thought; since this is kinda the NEW plist, maybe there'd be a official way to create "bpkl"s similar to bplists to make them as small as possible etc
@bioball commented on GitHub (Jul 18, 2024):
Gotcha. If you're using the pkl-go bindings (seems like you are), you can "bake" Pkl config into their binary representation using EvaluateExpressionRaw.
These bytes can then saved to a file or whatnot, and then be unmarshall'd into the codegen'd structs via Unmarshal.
@blacktop commented on GitHub (Jul 18, 2024):
Awesome! thank you
I don't really understand what the
exprarg is for here?4e6500ec73/cmd/internal/gen-fixtures/gen-fixtures.go (L41)@blacktop commented on GitHub (Jul 18, 2024):
I tried running this:
and this happened 😳
@bioball commented on GitHub (Jul 18, 2024):
Hm, that makes sense I guess. We store information in our binary format that isn't present in source code. You'll probably see a lot of gains by compressing it with gzip or something similar, because there's a lot of repetition in there.
expris the expression to evaluate within the module. If empty, it defaults to the whole module itself (equivalent to"module").@blacktop commented on GitHub (Jul 19, 2024):
thank you