Goja: A Golang JavaScript Runtime
jtarchie.com
Goja: A Golang JavaScript Runtime
1–10 of 36 posts
Re: Goja: A Golang JavaScript Runtime
#2Pocketbase is the framework that makes me want to switch to golang. It just makes a lot of sense.
One thing that concerned me, though. How do I debug goja? It doesn't seem like I can set breakpoints as usual.
Re: Goja: A Golang JavaScript Runtime
#3Re: Goja: A Golang JavaScript Runtime
#4This is the runtime pocketbase uses to allow javascript interop. Pocketbase is the framework that makes me want to switch to golang. It just makes a lot of sense. One thing that concerned me, though. How do I debug goja? It doesn't seem like I can set breakpoints as usual. https://pocketbase.io/
Re: Goja: A Golang JavaScript Runtime
#5This is the runtime pocketbase uses to allow javascript interop. Pocketbase is the framework that makes me want to switch to golang. It just makes a lot of sense. One thing that concerned me, though. How do I debug goja? It doesn't seem like I can set breakpoints as usual. https://pocketbase.io/
Actually I decided to learn golang for extending using Golang for better DX (type hints and compiler errors)
However, one of the strengths of pocketbase, I think, is that the creator chose to add bindings for a very well known scripting language (js) to allow projects to be rapidly developed. It feels like django rethought.
Using go for the base of your project and then gluing things together via scripting seems like a good idea. It's quite a big feature of the framework.
Re: Goja: A Golang JavaScript Runtime
#6In short: Goja is an ES5 interpreter written in pure Go and seamlessly integrating with it. You pass a struct, the JS side receives an object, you update it, and the Go side seamlessly gets an updated struct. No cgo overhead.
I say that because it's an interpreter rather than a jit, and doesn't have nearly as many person hours put into it as v8.
I can see the argument that if you just need to evaluate a quick expression or maybe some user supplied script or something, it could be very handy, but I have a hard time believing that the cgo overhead is a factor when using cgo to invoke v8 compared to the parse/jit overhead that v8 will do.
This is all armchair speculation of course. I use go regularly, but have no taste for javascript, so I have no dogs in that race. Definitely cool that there's an interpreter focused on correctness though.
Re: Goja: A Golang JavaScript Runtime
#7Re: Goja: A Golang JavaScript Runtime
#8Earlier quoted context omitted.
Actually I decided to learn golang for extending using Golang for better DX (type hints and compiler errors)
It's certainly a good idea to know golang while using something like pocketbase. However, one of the strengths of pocketbase, I think, is that the creator chose to add bindings for a very well known scripting language (js) to allow projects to be rapidly developed. It feels like django rethought. Using go for the base of your project and then gluing things together via scripting seems like a good idea. It's quite a b…
Re: Goja: A Golang JavaScript Runtime
#9Or is the point of it to be able to use existing JS scripts within a Go application?