WebAssembly proposal touted to improve Wasm web integration

The WebAssembly Component Model, an architecture for building interoperable WebAssembly libraries, applications, and environments, is being touted as a way to elevate Wasm beyond its current status as “a second-class language for the web.”

The WebAssembly Component Model, in development since 2021, would provide critical capabilities for WebAssembly, according to a February 26 blog post from Mozilla software engineer Ryan Hunt. These capabilities include:

  • A standardized self-contained executable artifact
  • Support by multiple languages and toolchains
  • Handling of loading and linking of WebAssembly code
  • Support for Web API usage

A WebAssembly component defines a high-level API that is implemented with a bundle of low-level Wasm code, Hunt explained. “As it stands today, we think that WebAssembly Components would be a step in the right direction for the web,” he wrote.

Mozilla is working with the WebAssembly Community Group to design the WebAssembly Component Model, and Google is evaluating the model, according to Hunt. In his post, Hunt argued that despite WebAssembly adding capabilities such as shared memory, exception handling, and bulk memory instructions since its introduction 2017, it has been held back from wider web adoption. “There are multiple reasons for this, but the core issue is that WebAssembly is a second-class language on the web,” Hunt wrote. “For all of the new language features, WebAssembly is still not integrated with the web platform as tightly as it should be.”

WebAssembly has been positioned as a binary format to boost web application performance; it also has served as a compilation target for other languages. But Hunt argued that WebAssembly’s loose integration with the web leads to a poorer developer experience, so that developers only use it when they absolutely need it.

“Oftentimes, JavaScript is simpler and good enough,“ said Hunt. “This means [Wasm] users tend to be large companies with enough resources to justify the investment, which then limits the benefits of WebAssembly to only a small subset of the larger web community,” he wrote. JavaScript has advantages in loading code and using web APIs, which make it a first-class language on the web, wrote Hunt, while WebAssembly is not. Without the component model, he argued, WebAssembly is too complicated for web usage. He added that standard compilers do not produce WebAssembly that works on the web.

Go to Source

Author: