Timeouts for Regexp is quite interesting. The engineering purity in me saddens at such a thought, but indeed it seems highly practical.<p>The syntax feels a little rough although I have no ideas how to make it better:<p><pre><code> Regexp.timeout = 1.0
...
/^a*b?a*$/ =~ "a" * 50000 + "x"
</code></pre>
I think I would favor the:<p><pre><code> long_time_re = Regexp.new("^a*b?a*$", timeout: 1.0)
</code></pre>
version instead but I use the `=~` almost entirely, so that would still be a big style change. Probably end up setting a global timeout per app and then overriding for individual checks as needed?
One notable thing is the ruby apps in a single .wasm file. This may make ruby CLI apps easier, as well as eventually replacing things like docker or shipping your ruby code to a server.
This looks awesome! I've already played around with pyodide and coldbrew doing the same thing for CPython. I use it for an in-memory playground [0] of an open-source desktop app I build [1]. I've been waiting for Ruby, Julia, and R support to add them in too.<p>That said, I am not seeing a link in here about how to actually use this code. Is there a good tutorial/example somewhere?<p>[0] app.datastation.multiprocess.io<p>[1] github.com/multiprocessio/datastation
This is super exciting!<p>They also created an awesome playground to try Ruby online [1]... all powered by Wasmer/WASI [2]!<p>[1] <a href="https://try.ruby-lang.org/playground/" rel="nofollow">https://try.ruby-lang.org/playground/</a><p>[2] <a href="https://wasmer.io" rel="nofollow">https://wasmer.io</a>
What I can see here with WASM is that in the near future Ruby community could build their frontend frameworks so you can develop using 98% ruby in your app.<p>There were attempts in the past to use ruby in the frontend, by compiling it to JS (opalrb), so I looking forward to see how the ruby community exploits WASM.<p>While I don't know how good it will be it still interesting the possibilities that WASM bring to the table, no more forced to use one language for the browser, use whatever language you like!
Here is IRB running in the browser by author of this feature<p><a href="https://irb-wasm.vercel.app/" rel="nofollow">https://irb-wasm.vercel.app/</a><p>No installation required :)
What would really excite me is adding WASM support for native extensions. Installing gems in our CI for arm64/M1 takes about 40 times longer than the actual build.
Regarding WASM, what are the benefits to users? Is it that html/js/css loads 2-10 times faster?<p>Also, what's the impact on a typical rails/ruby dev? Do they have to learn anything new to enjoy improvements WASM brings, or will all the changes be 'under the hood' (i.e. in ruby and/or rails)?
I've been very attracted to learn Ruby a couple of times, being exhausted of the JS ecosystem. Everybody who's used it seems to fall in love with it, but I can't get over just how slow it is... It takes a fresh installation of Discourse over 10 minutes to start-up again on a small underpowered VM and uses 10x as much RAM as an alternative platform such as Flarum.