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 10 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.
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 is not yet production-ready. Although everything necessary for the JWebAssembly 1.0 release has been implemented, testing still remains to be done. The version 1.0 roadmap calls for capabilities such as a Java bytecode parser, a test framework, and a Gradle plug-in. I-Net Software expects to ship JWebAssembly 1.0 this year.
You can download JWebAssembly from GitHub.
You can find instructions for downloading and using Pyodide at pyodide.org.
You can find instructions for downloading and using TeaVM on GitHub.
Copyright © 2021 IDG Communications, Inc.