Replies: 3 comments
-
At the moment I can’t embed cue runtime inside wasm due to the json encoder used by cue. There are golang packages that exactly match the standard json encoders api that have no reflection and are faster would the maintainers of Cue be open to this though if the json encoded is maintained and tested ? |
Beta Was this translation helpful? Give feedback.
-
Here is the reference to the respective json code that messes up WASM compilation https://github.com/cue-lang/cue/blob/master/encoding/json/json.go#L19 |
Beta Was this translation helpful? Give feedback.
-
I did a quick test and compiled a Go program using CUE with GOOS=js GOARCH=wasm, with no issues. Did you run into any particular errors or issues? Are you using the real Go implementation, or something else like TinyGo (that IIRC has had limitations that prevent using encoding/json). |
Beta Was this translation helpful? Give feedback.
-
I am building gui and non gui systems with golang that are low code style platforms
My weapon of choice is gioui which is golang based for building gui that compiles to web ( wasm ), desktop and mobile.
so i was wondering if the cuelang “ interpreter “ for want of a better word , can be imported into golang wasm ?
This would allow me to let’s users write Cuelang scripts to do data transformation, data validation and possible actions. They would not have to recompile and so would not need to be developers but could be business analysts with domain specific knowledge.
their cuelang scripts could be stored on the server and requested like any resource using HTTP or GRPC.
Maybe I am jumping the gun in this and the cuelang Playground essentially proves that cross compiling the cuelang runtime into wasm using a GOOS=js just works.
Also I would not be storing the cuelang files in the file system but rather in memory. Does that make it easier ? Otherwise there is a golang Package that matches the standard golang api in terms of filepaths and can run in a wasm browser context . Under the hood it uses indexdb to store the files.
This is the File system abstraction:
https://github.com/hack-pad/hackpadfs
Beta Was this translation helpful? Give feedback.
All reactions