Preface

I believe WebAssembly is an ascendant technology that has the potential to transform the entire software development industry in one form or another. I do not believe WebAssembly is going to be transformative because I am writing a book on the topic. I’m writing a book on it because I believe it will be transformative.

Presumably you are interested in the technology as well. The problem is, I think I have less of an idea of who you are as a reader than many authors do. If this were a book about a particular programming language or a specific topic, there would be a self-selecting aspect to the audience and I could proceed apace. But WebAssembly is a much larger topic than most people realize, and I am trying to paint a very large picture with this book. Most of the other books that have been published have focused on a single aspect of it, and I can understand why.

Some of you might think WebAssembly is a technology for killing JavaScript. It isn’t. Some of you may think it is about bringing applications to the browser. It is that, but it is also so much more. It is useful on the server side, in the video game world, as a plug-in mechanism, in support of serverless functions and edge computing, in embedded systems, for the blockchain, and in many other topics we will investigate together. This is the first attempt I know of to be this comprehensive with the topic, and I felt it was important to tell this more complete version.

In the lead-up to the publication of this book, I have mostly gotten positive support and excitement from people I have spoken to about the project. One limited form of pushback I have gotten is with respect to the title. Some folks felt it was premature to have “The Definitive Guide” for this new of a technology. That is a fair position to take, but because I am trying to describe an extremely big and encompassing technical landscape, I thought it was reasonable. I hope by the end of the book you agree.

All I ask is that you have an open mind and a bit of patience. WebAssembly touches a lot of languages, runtimes, and operational environments. In addition to teaching you about the low-level details, we will look at integrations with the dominant programming languages in this space and several different use cases. I have tried not to make too many assumptions about your background, so I have heavily annotated the text with breadcrumbs for further exploration and discovery via footnotes. If you are a more advanced developer just seeking details about WebAssembly, feel free to ignore these and don’t take offense. I expect a rather wide audience will be at least perusing this book, and I want them to feel welcome, too.

If you are on the junior side development-wise, this will be a challenging book. But I have tried to make it possible for you to at least see what is going on. Consider the various links and references as a personal guide into a more sophisticated development reality. Don’t get overwhelmed, just tackle things one at a time in whatever order interests you or makes sense. There is no single way into this industry, and however you get there is legitimate.

At the end of the day, WebAssembly is going to allow us to basically choose our programming languages and run them securely in just about any computational surface area. We have been promised this before, but I think this time it is more likely to come to fruition. Thank you for giving me the opportunity to explain why.

Conventions Used in This Book

The following typographical conventions are used in this book:

Italic

Indicates new terms, URLs, email addresses, filenames, and file extensions.

Constant width

Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.

Constant width bold

Shows commands or other text that should be typed literally by the user.

Constant width italic

Shows text that should be replaced with user-supplied values or by values determined by context.

This element signifies a tip or suggestion.

This element signifies a general note.

Using Code Examples

Supplemental material (code examples, exercises, etc.) is available for download at https://github.com/bsletten/wasm_tdg.

If you have a technical question or a problem using the code examples, please send email to .

This book is here to help you get your job done. In general, if example code is offered with this book, you may use it in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but generally do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “WebAssembly: The Definitive Guide by Brian Sletten (O’Reilly). Copyright 2022 Bosatsu Consulting, Inc., 978-1-492-08984-1.”

If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .

O’Reilly Online Learning

For more than 40 years, O’Reilly Media has provided technology and business training, knowledge, and insight to help companies succeed.

Our unique network of experts and innovators share their knowledge and expertise through books, articles, and our online learning platform. O’Reilly’s online learning platform gives you on-demand access to live training courses, in-depth learning paths, interactive coding environments, and a vast collection of text and video from O’Reilly and 200+ other publishers. For more information, visit http://oreilly.com.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

  • O’Reilly Media, Inc.
  • 1005 Gravenstein Highway North
  • Sebastopol, CA 95472
  • 800-998-9938 (in the United States or Canada)
  • 707-829-0515 (international or local)
  • 707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at https://oreil.ly/webassemblyTDG.

Email to comment or ask technical questions about this book.

For news and information about our books and courses, visit http://oreilly.com.

Find us on Facebook: http://facebook.com/oreilly

Follow us on Twitter: http://twitter.com/oreillymedia

Watch us on YouTube: http://youtube.com/oreillymedia

Acknowledgments

At times, our own light goes out and is rekindled by a spark from another person. Each of us has cause to think with deep gratitude of those who have lighted the flame within us.

Albert Schweitzer

The myth of the sole author is persistent. I have huge communities of people to thank for the production of this book and their assistance to me along the way. On the other hand, I alone am responsible for any errors, inaccuracies, and problems.

I would like to start with the larger WebAssembly community. They have done a remarkable job in designing this platform without overdesigning it. It is a moving target, and they are busy juggling and balancing a surplus of competing issues. Along the way, they have left breadcrumbs to explain decisions and lay the foundations for the future. I would like to call special attention to the contributions of Lin Clark, who has emerged as one of my favorite technical communicators. Not only is she generous with her time, but her cartoon introductions to complex topics are also among the most effective forms of technical communication I have encountered.

The O’Reilly community is a top-notch organization. Everyone I have encountered there, current and past, has been a solid representative of the brand. I would like to thank Mike Loukides for his time in discussing my much larger views and suggesting we start with WebAssembly. My editors, Zan McQuade and Angela Rufino, have been stalwart champions of the project with the absolute patience of Job. Kate Galloway and her team helped me get it across the finish line. I would like to issue a special thank you to Karen Montgomery for the beautiful cover. My dogs’ groomer is especially fond of it, as you caught the essence of this ridiculously lovable breed of Norwich terriers. For those who have questioned the relevance, they are the smallest working dog and—as I pitched it—small, fast, and portable, just like WebAssembly.

For insight into the various WebAssembly use cases, I interviewed several members of the projects and companies I mention throughout. In no particular order, I would like to express my gratitude to Tim McCallum, Aaron Turner, Connor Hicks, Liam Randall, Kevin Hoffman, Sasha Krsmanovic, Jérôme Laban, and Francois Tanguay.

The technical reviewers have honored me with the gift of their time and feedback. I would like to thank Dr. Sam Bail, Taylor Poindexter, Hannah Thoreson, Brooks Townsend, Jay Phelps, David Sletten, and the incomparable Dr. Venkat Subramaniam.

I was given a venue to begin speaking professionally about WebAssembly by Jay Zimmerman of the No Fluff Just Stuff conference series back in 2017. He and I knew it was too soon, but we wanted to start the conversation and I appreciate the opportunity. The rest of the speakers and attendees of this remarkable technical carnival have given me no end of inspiration and feedback, for which I am so much the richer.

My friends and family have encouraged and supported me in all things, a debt I will never be able to repay. No one has done more than my wife and friend, Kristin. She and our dogs, Loki and Freyja, have made this time at home during the pandemic not just bearable, but richer than my life on the road.

Thank you, all.

Get WebAssembly: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.