Google Recommends AssemblyScript for Web Assembly Programming

Today at the annual Google I/O developer conference, Surma (Web Advocate at Google) hosted the session "WebAssembly for Web Developers." Surma recommended using AssemblyScript in order to convert code written in TypeScript into the portable binary format, WebAssembly. WebAssembly makes it so that code written in C/C++ and Rust is able to run on Chrome, Safari, Firefox and Edge Web browsers.

WebAssembly, a widely accepted standard designed by the W3C is supported by W3C, Mozilla, Microsoft, Google and Apple, allows developers to implement processor intensive features such as complex image rendering by allowing Web pages to have low-level access to native computing resources. AssemplyScript makes it so developers can avoid the difficulty of programming in a low-level language such as C++ by using TypeScript, which is a strong type adaptation of JavaScript, the defacto language for programming Web pages that run on the internet. Using TypeScript combined with AssembyScript makes the power of low-level computing available to general purpose Web developers. The result is a more feature rich computing experience within the browser.

According to Surma, using AssemblyScript means that, “you don’t have to learn a new language to write to WebAssembly.”

Surma praised the benefits of AssemblyScript but points out that there is a challenge to be overcome in terms of memory management. Surma states, “Something to keep in mind is that, unlike TypeScript, WebAssembly doesn’t have the garbage collection, at least not yet.”

Thus developers using AssemblyScript will need to do their own memory management at the present time until a future version of AssemblyScript with garbage collection is released.

AssemblyScript has been on GitHub project since February 21, 2019, and enjoys a growing number of community projects and implementations. The language has been used to write the GameBoy wasmboy, Gameboy Emulator, also the original game, Gomoku. Also, there are utility libraries available such as the JSON encoder/decoder, assemblyscript-decoder, that help developers with some of the more mundane tasks associated with AssemblyScript programming.

Given the growing community support and the current endorsement from Google, AssemblyScript is positioned to be an important part of the WebAssembly ecosystem.

Be sure to read the next Application Development article: Salesforce Open Sources Lightning Web Components