Today’s web applications are nowhere near as fast and responsive as native desktop applications, but what if they could be? That’s the promise of WebAssembly.
WebAssembly is a low-level, assembly-like language with a compact binary format that runs with near-native performance in web browsers. At the same time, WebAssembly provides a portable compilation target for C/C++, C#, Rust, Go, Kotlin, Swift, and other programming languages.
WebAssembly has led to the development of a range of new technologies, including whole new programming languages, that harness its power. Following are 14 language projects that have made big bets on WebAssembly.
The internal IR (intermediate representation) of Binaryen uses compact data structures and draws on all CPU cores for parallel codegen and optimization. The IR also compiles down to WebAssembly easily because it is essentially a subset of WebAssembly. WebAssembly-specific optimzations improve both code size and speed, making Binaryen useful as a compiler back end by itself.
You can download Binaryen from GitHub.
Instructions for getting started with Blazor can be found at dotnet.microsoft.com.
You can download Cheerp from leaningtech.com.
Like Cheerp, CheerpJ comes from Leaning Technologies. You can download it from leaningtech.com.
You can download Emscripten from emscripten.org.
Still in early development, Extism is a plug-in system for running WebAssembly extensions within an app, with the goal of making all software programmable. Common use cases for Extism include adding functionality to command-line tools, creating user-defined functions in a database, making no-code application extensions, and creating extensions for content management systems. With Extism, developers can use idiomatic host SDKs for languages including Go, Ruby, Python, Rust, and C++. The developers of Extism say it is usable now but still has some rough edges.
Instructions for installing Extism can be found at extism.org.
Forest is a functional programming language that compiles to WebAssembly. The goal behind Forest is to provide a language that makes it easier to create web apps that are complex, interactive, and functional, but without the traditional overhead of that approach, developer Nick Johnstone said.
Currently described as “pre-alpha, experimental, conceptual research software,” Forest features static typing, pattern matching, immutable data structures, multiple syntaxes, and automatic code formatting. The first syntax in development is inspired by Elm and Haskell.
Design principles of the Forest language include ease of collaboration, painless-as-possible testing, and agreement on structure and semantics, while agreeing to disagree on syntax. Johnstone strives to make Forest fast enough for building complex games so that normal web apps will be “blazing fast.”
You can download Forest from GitHub.
The Grain language brings features from academic and functional languages to the 21st century, the project website states. Compiling to WebAssembly via the Binaryen toolchain and compiler infrastructure, Grain can run in the browser, on the server, and potentially anywhere. There are no runtime type errors and no need for type annotations. The Grain toolchain features a CLI, compiler, runtime, and standard library, shipping as a single binary. Developers will need Node.js and Yarn to build Grain from source, and binaries are available for Linux, MacOS, and Windows.
You can find instructions for getting started with Grain at grain-lang.org.
JWebAssembly, from I-Net Software, is a Java bytecode to WebAssembly compiler that takes Java class files as input and generates WebAssembly binary format (.wasm file) or text format (.wat file) as output. The target is to run natively in the browser with WebAssembly. In theory, JWebAssembly can compile any language that compiles to Java bytecode such as Clojure, Groovy, JRuby, Kotlin, and Scala, pending testing.
JWebAssembly should be production-ready soon. All of the milestones necessary for the JWebAssembly 1.0 release have been implemented, and a release candidate has been published. The version 1.0 roadmap calls for capabilities such as a Java bytecode parser, a test framework, and a Gradle plug-in.
You can download JWebAssembly from GitHub.
You can find instructions for downloading and using Pyodide at pyodide.org.
Spin, from cloud computing software provider Fermyon Technologies, is a WebAssembly framework for microservices, web apps, and other server-based applications. Developers can use Spin to write WebAssembly for the cloud. Interfaces are provided for writing WebAssembly modules for functions such as answering HTTP requests. With Spin, developers can use languages including Rust, Go, Python, Ruby, AssemblyScript, Grain, C/C++, and others. Spin supports WAGI (WebAssembly Gateway Interface) modules and the Bindle packaging system. Now in an early preview phase, Spin is considered experimental code, with breaking changes expected before the first stable release.
Spin is hosted on GitHub.
You can find instructions for downloading and using TeaVM on GitHub.
An alternative to the Xamarin mobile app platform, Uno Platform is a UI platform for .NET teams to build single-codebase applications for WebAssembly, the web, Windows, MacOS, Linux, iOS, and Android, using C# and XAML. Uno leverages the Mono-WASM runtime in .NET 5 to run C# code in all of the major web browsers, and serves as a bridge for WinUI and UWP (Universal Windows Platform) apps to run natively on WebAssembly. For building web apps with Uno, developers can use Visual Studio or Visual Studio Code.
Directions on getting started can be found on the Uno Platform website.
From Cosmonic, Wasmcloud is an application runtime that leverages WebAssembly in the development of composable, portable applications that plug into multi-cloud, edge, and browser environments. The technology is billed as offering near-native performance, with security provided via a WebAssembly sandbox and an actor model separating business logic from specific underlying capabilities. Developers can write microservices once in the language of their choice and deploy them everywhere. Current languages supported include Rust, TinyGo, and AssemblyScript. Wasmcloud has been accepted as a Cloud Native Computing Foundation (CNCF) Sandbox project.
Installation instructions for wasmCloud can be found at wasmcloud.dev.
Copyright © 2022 IDG Communications, Inc.