12 comments

[ 2.9 ms ] story [ 25.6 ms ] thread
I'm a little confused by this. Did someone manage to write a YARV to WASM compiler? I kind of doubt this is a wholly new Ruby to WASM compiler, so my best guess would be a YARV to WASM compiler. Except...even that would be tricky since Ruby has a notoriously complicated runtime. Just looking at this though, it looks like they just compiled an existing Ruby implementation to WASM via Emscripten. But that's not really compiling Ruby to WASM then...
I think this is a Python v.s. CPython sort of confusion- you can run Python code in CPython which can compile to wasm, but you can't directly compile Python source to wasm in a nontrivial way (i.e. just shipping CPython with your source in a single wasm binary doesn't count, sorry, yes I know you heard about the futamura projections yesterday but this isn't actually very interesting)
(comment deleted)
Yeah, look like it is compiling Ruby (the interpreter, aka MRI or CRuby), not programs written in the language Ruby.
So , the maximum you can get from it is the console log text return of the script you paste there. right? Or you can glue your script with anything like webgl or canvas there to do anything?
WASM doesn't provide DOM access so you can't use anything useful on the web unless you callback through a bunch of JS.
It's 'compiling Ruby' as in 'compiling the program called Ruby', not 'compiling programs written in the Ruby language'.
I'm proud that this project's Dockerfile bases on mine :D Didn't expect it will be used widely.