Ruby 3.2.0 Preview 1 Released - with Wasm support

RUBY-LANG.ORG.IO

Ruby is a popular language, most often associated with the Ruby on Rails, a server-side web framework. Ruby is an interpreted and high-level language, which relies on a garbage collector for memory management. As a result, Ruby applications cannot be compiled directly to WebAssembly (like Rust, C++ or AssemblyScript), instead, the runtime itself needs to be compiled to WebAssembly.

Ruby

The Ruby 3.2.0 Preview 1 release announces just that! Ruby now has support for WebAssembly and WASI, which means you should be able to run it everywhere that supports the Wasm runtime and WASI interfaces.

You can find the technical details of how this was achieved in a blog post from one of the Ruby team members. Also, if you just want to give it a go for yourself, Wasm Builders has a nice little intro.

Javy: A Jav aScript to WebAssembl y toolchain

GITHUB.COM

Similar to Ruby, JavaScript is also interpreted, garbage collected etc … which means it cannot be compiled directly to WebAssembly. In order to run JavaScript, you also have to include a suitable runtime. For example, this blog post describes running JavaScript via QuickJS.

This might sound like a heavyweight solution, however, it is surprisingly viable. I was at QCon last week where Will Overton (from Fastly) gave a talk where he mentioned that they use exactly this technique to run JavaScript on their edge network. They also make use of cool tools like Wizer to pre-initialise the modules ahead of execution.

Anyhow, back to Javy - what this looks like is a tool that takes care of bundling up QuickJS and your JavaScript code into a WebAssembly module. I found a brief tutorial on Wasm Builders that outlines the process.

Introducing Spin

FERMYON.COM

Fermyon are coming up with all sorts of cool stuff at the moment, for example WAGI (featured back in Issue #136, a CGI-inspired WebAssembly runtime. This blog post announces Spin, a new microservices framework where your services are written as WebAssembly modules.

The team are already eating their own dogfood, with the docs site running on Spin and Bartholomew (their own WebAssembly-powered CMS).

Writing Redux Reducers in Rust

FIBERPLANE.DEV

Reducers are small pieces of logic that apply actions to the state in a Redux store. They have a simple interface, and are side-effect free, which means it is quite easy to move them into WebAssembly. Probably not terribly practical, but if you’re learning about WebAssembly, it’s a good starting point.

Static Full-Text Search in Next.js with WebAssembly, Rust, and Xor Filters

HACKERNOON.COM

This blog post looks at how to add client-side full-text search capabilities using WebAssembly.