Proposal to merge WASI based WebAssembly support
bugs.ruby-lang.org
bugs.ruby-lang.org
For any Python devs like myself, Pyodide is doing incredible things and can already run much of the scientific Python stack in the browser.
https://github.com/pyodide/pyodide
This is the Python bug tracking adding WASM support to cpython natively:
Would this mean that instead of complicated Ruby deployments where I need an app server, a Ruby runtime and a bunch of other magic that I could theoretically just end up with a single binary that contained everything in it?
Secondly, this is shipping a Ruby runtime inside of WASI or is it aiming to “compile” to “native”?
Not exactly sure what those terms mean in a WASI context hence the quotes.
Then finally, does this also theoretically do something big for Ruby’s performance metrics?
Edit: thanks for the insight in the comments below
My understanding is the main benefit is that you can have one ruby interpreter that can be used on any CPU architecture or operating system. This is especially interesting for web as you can implement the WASI interface and then run Ruby in the browser. This is especially cool for learning tools and IDEs.
Another benefit is that by using a "safe" WASI backend you could run Ruby sandboxed which could be helpful for testing and dynamic analysis of untrusted code or even for IDE support for potentially dangerous code. (For example you can run the `rm -r /` function to see it's return type without actually letting it wipe the disk.)
> that I could theoretically just end up with a single binary that contained everything in it?
I don't think this changes anything here. You could do this just as easily with or without.
> this is shipping a Ruby runtime inside of WASI or is it aiming to “compile” to “native”?
My reading says that it is the former. Compiling the Ruby runtime to WASI.
> Then finally, does this also theoretically do something big for Ruby’s performance metrics?
It likely hurts performance as WASM will be slower than native.
WASI is just an interface to the host system and is not specifically related to native compiling
It's good to see this: Hopefully we'll see more ecosystems support this going forward.
Building C++ is already quite painful, but adding webassembly seems to really make it even more sadistic.
WASM seems like an awesome thing, but emscripten makes it quite unpleasant.
fun, I just pass the emscripten toolchain to CMake and things mostly JustWorksTM