Skip to Content
WebAssembly: The Definitive Guide
book

WebAssembly: The Definitive Guide

by Brian Sletten
December 2021
Intermediate to advanced
332 pages
8h 36m
English
O'Reilly Media, Inc.
Book available
Content preview from WebAssembly: The Definitive Guide

Chapter 14. Using AssemblyScript and WebAssembly

There’s something strange going on tonight There’s something going on that’s not quite right Joey’s nervous and the lights are bright There’s something going on that’s not quite right

Wire, “Strange”

It is getting harder for me to make cultural references that the general populace gets. There is a good chance that many of the people reading this book will not recognize this song, but it is still important to reference the classics. For those of you cultured enough1 to recognize the aforementioned song as an R.E.M. song on the Document album,2 you may be surprised to learn it is a cover. The original was done by the band Wire. If you listen to the original, your reaction to this might be that something strange is going on, just like the song says. It is both familiar and not at the same time.

In this chapter, I am going to introduce a language called AssemblyScript that might prompt the same reaction. It is a Binaryen-based compiler that turns a subset of TypeScript into WebAssembly. It is obviously similar to TypeScript (which is, in turn, similar to JavaScript), but upon closer inspection, something strange is going on here, too. Still, it fits a different use case for WebAssembly and shows you how versatile this platform can be.

TypeScript is a popular superset of JavaScript that transpiles3 to regular JavaScript so that it will run anywhere JavaScript will. Its main purpose is to express your intent using a strongly typed ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

gRPC: Up and Running

gRPC: Up and Running

Kasun Indrasiri, Danesh Kuruppu
Real-World Next.js

Real-World Next.js

Michele Riva
Microservices Patterns

Microservices Patterns

Chris Richardson

Publisher Resources

ISBN: 9781492089834Errata Page