Go code runs locally in browser powered by Rust via Wasm

132 points oxfeeefeee

// I made a context lacking post earlier, and am hoping to fix that with this ver 2.0

https://goscript.dev/

So I implemented a script version of Go in Rust, and with that I made a playground by compiling it to Wasm. It was so easy and worked just as I expected, and I got excited.

Here is how it works: The Goscript is just a CPython style interpreter that runs Go code, and the playground send user input and a zip file containing Go library source files to the interpreter, and the interpreter, which is just a Wasm library, runs to code and returns the output.

I was amazed by how easy it was to make the playground, I guess that shows how good the Rust-Wasm ecosystem is.

And some thoughts about Rust. I tried Rust because I heard it's the most loved language, what I find out is that it deserves its fame. I've used all kinds of languages and now Rust is my favorite. It's the perfect version of C++ we've always wanted. It may take more time to code but it's much much easier to debug. If you want to create lasting and efficient software, and have fun doing it, it's most likely you should choose Rust. Thanks to the creators and ecosystem contributors!

If I had to name one best thing about Rust it's this: Rust compiler nudges you to write better smelling code.