Hacker News new | ask | show | jobs
by the_duke 1894 days ago
Go seems like a suboptimal language for implementing an interpreter, since it lacks the low level primitives to make a fast interpreter loop.

But I guess, as will all things Go, that it will be fast enough for a good amount of use cases, and having a language native dependency rather than messing with C libraries is always a plus.

3 comments

Yes, Go is fast enough for some tasks.

Before this I was doing C and PUC-Rio Lua. Was obsessing too much with C pitfalls, valgrind, and the sanitizers. Then LuaJIT FFI + Rust, good I like it better but found GopherLua the easiest. I'd stick with LuaJIT+Rust for anything that needs less resources and speed.

Go has all the required primitives, unsafe and assembler as part of the toolchain.
If he really wanted to, he could have written it as a JIT and generate ASM directly. Writing an executable page is quite trivial in Go.