Software Development / Technology

The Promise of WebAssembly Heads to Ruby

9 Apr 2022 6:00am, by
programming diagram

While Ruby didn’t exactly top the list of most desired languages in the 2021 State of WebAssembly survey (that honor went to Rust, with Go and C++ following close behind), that is precisely what happened this week, nonetheless.

Well, more specifically, the first preview of Ruby 3.2.0 provides WebAssembly System Interface (WASI) based WebAssembly support, which “enables a CRuby binary to be available on Web browser, Serverless Edge environment, and other WebAssembly/WASI embedders.”

WebAssembly, in case you’re unfamiliar, brings languages other than HTML, CSS, and JavaScript to the browser (and other locations), and a few years ago was named by the World Wide Web Consortium (W3C) as “the fourth language for the web which allows code to run in the browser.”

While the implementation is in its early days and lacks some functionality, there is some excitement from the Ruby community, nonetheless.

A blog post last month by Ruby committer Yuta Saito provided an update on WebAssembly/WASI Support in Ruby, and in it, Saito explained some of the reasoning and backstory. Ruby, Saito explains, was already supported in WebAssembly using Emscripten, but this implementation was heavily reliant on the host JavaScript environment. By moving over to WASI, Ruby can now be used not just in the browser, but also “in a variety of situations such as edge computing, embedded environments, and interfaces for plug-in systems.”

“WASI is an effort to define a standard set of syscalls for WebAssembly modules, allowing WebAssembly modules to not only be portable across architectures but also be portable across environments implementing this standard set of system calls,” Saito explains. “WASI does not rely on JavaScript at all.”

For full technical details, head on over to Saito’s blog post, which goes into the weeds on how this will be implemented and what the limitations are currently. Beyond that, if you want to give it a go, give this quick startup guide a read and get started.

This Week in Programming

  • Lambda Gets Built-In HTTPS Endpoints: While it may have been technically possible to create an API endpoint for an AWS Lambda function using Amazon API Gateway, the task has just become that much simpler with AWS’s new Lambda function URLs. Now, without having to learn or use any other services, AWS Lambda users can add HTTPS endpoints to any Lambda function and, if they like, configure Cross-Origin Resource Sharing (CORS) headers, which allow you to indicate “origins (domain, scheme, or port) other than its own from which a browser should permit loading resources”. The purpose of this new feature is to make it quick and easy to get an endpoint up and running, but if you need advanced functionality, such as validation or throttling, Amazon API Gateway may be a better bet. Isn’t that just it, though? The other big benefit of this new feature is that you don’t have to go paying for the Amazon API Gateway anymore. For full details on exactly how to set them up, when to use them versus not, and how much they might cost (cost is included in Lambda’s request and duration pricing), head on over and give the blog post a gander.
  • Meta Continues Its F8 Pause: Despite the seemingly ubiquitous return of conferences in recent times, it would appear that Meta has decided to continue with its pausing of F8 in 2022. F8 was Facebook’s developer conference that was canceled in 2020 and held virtually in 2021. “Similar to years past, we are taking a brief break in programming and will not hold F8 in 2022 while we gear up on new initiatives that are all tailored towards the next chapter of the internet, and the next chapter of our company too: building the metaverse,” the company wrote in a blog post announcing the move. If AR, VR, and the metaverse are your thing, however, Facebook says that it’s ready to move forward on that later this year at its “Connect” event.

  • What’s Next for GitLab’s OpsTrace Acquisition? In a blog post this week about observability being key to cloud native transitions, it seems the lead was a bit buried. While the general discussion was just fine, GitLab also linked to a recent blog post by OpsTrace, a company they acquired in 2021, in which OpsTrace shared an update on its integration into GitLab. In the blog post, which was originally written late last month, OpsTrace wrote that it wanted to share “two key updates”, with the first being that it will be “starting a new open source project to build a new observability user interface (UI), GitLab Observability UI” be based on a fork of the last Apache-licensed branch (7.5.x) of Grafana. In the FAQ to this update, OpsTrace offers that it is doing this because “Using an existing base allows us to move quickly and focus on an improved UX right away while being compatible with a wide range of existing Prometheus dashboards.” The resulting project will be licensed under Apache 2.0 to allow for the “UI to be embedded in GitLab and other companies’ existing products.” At the same time, OpsTrace is also unifying “the backend for metrics, logs and traces on ClickHouse” and removing Loki for licensing reasons, so that they might create their own Apache-licensed logging backend on top of ClickHouse. All of this, corporate caveats aside, likely coming to a GitLab near you in the near-ish future.

  • GitHub’s New Action Prevents Vulnerability Intro: While GitHub’s Dependabot service already lets you know if one of your dependencies has a vulnerability, it’s still possible to introduce a vulnerability by adding a new dependency. That’s why GitHub has added a new action to prevent the introduction of known vulnerabilities into your code. The new dependency review action introduced this week “automates finding and blocking vulnerabilities that are currently only displayed in the rich diff of a pull request” by scanning pull requests for dependency changes and then comparing with the GitHub Advisory Database for existing vulnerabilities in those dependencies. The new action is on the GitHub Marketplace, although, buyer beware, this is all in public beta, so the new API endpoint is still a bit of a moving target.
  • Rust Puts Out 2024 Roadmap: Just like it did earlier this year for the Rust Compiler Ambitions for 2022, the Rust team this week published its Rust Lang Roadmap for 2024, which serves as a snapshot of the living roadmap and summary of what the team is working towards for Rust 2024. The common theme of the roadmap, they write, is “to empower everyone to build reliable and efficient software” according to three basic themes. First, they plan to flatten the (learning) curve, by making Rust easier to learn and more accessible. Next, help Rust’s users help each other by making life easier for library authors and their users. Finally, help the Rust project itself scale, by developing processes to scale to the needs and use cases of a growing number of users. This summary is just barely that, however. The blog post goes into great detail on the vision behind each of these three areas, the plan for achieving them, and ways that you, the Rust community, can get involved to make them a reality, so if any of that is of interest, head on over and give it a read.

The New Stack is a wholly owned subsidiary of Insight Partners, an investor in the following companies mentioned in this article: Docker.