WebAssembly The Definitive Guide Safe Fast and Portable Code 1st Edition Brian Sletten All Chapter Instant Download
WebAssembly The Definitive Guide Safe Fast and Portable Code 1st Edition Brian Sletten All Chapter Instant Download
com
OR CLICK BUTTON
DOWLOAD NOW
More products digital (pdf, epub, mobi) instant
download maybe you interests ...
https://ebookmeta.com/product/webassembly-the-definitive-guide-
safe-fast-and-portable-code-early-release-1st-edition-brian-
sletten/
https://ebookmeta.com/product/webassembly-the-definitive-
guide-1st-edition-brian-sletten/
https://ebookmeta.com/product/beautiful-c-30-core-guidelines-for-
writing-clean-safe-and-fast-code-1st-edition-j-davidson-kate-
gregory/
https://ebookmeta.com/product/css-code-code-of-safe-practice-for-
cargo-stowage-and-securing-2011-ed-edition-international-
maritime-organization/
Hadoop The Definitive Guide Tom White
https://ebookmeta.com/product/hadoop-the-definitive-guide-tom-
white/
https://ebookmeta.com/product/design-the-definitive-visual-guide-
dk/
https://ebookmeta.com/product/gatsby-the-definitive-guide-1st-
edition-preston-so/
https://ebookmeta.com/product/snowflake-the-definitive-guide-1st-
edition-joyce-avila/
https://ebookmeta.com/product/javascript-the-definitive-guide-
activate-your-web-pages-definitive-guides-david-flanagan/
WebAssembly: The Definitive
Guide
Safe, Fast, and Portable Code
Brian Sletten
WebAssembly: The Definitive Guide
by Brian Sletten
Copyright © 2022 Bosatsu Consulting, Inc. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North,
Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales
promotional use. Online editions are also available for most titles
(http://oreilly.com). For more information, contact our
corporate/institutional sales department: 800-998-9938 or
corporate@oreilly.com.
Proofreader: JM Olejarz
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.
For more than 40 years, O’Reilly Media has provided technology and
business training, knowledge, and insight to help companies succeed.
Sebastopol, CA 95472
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 bookquestions@oreilly.com 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.
Chapter 1. Introduction
Safe
Fast
Portable
Compact
In this vision, WebAssembly is centered at the intersection of
software development, the web, its history, and how it delivers
functionality in a geographically distributed space. Over time, the
idea has expanded dramatically beyond this starting point to imagine
a ubiquitous, safe, performant computational platform that touches
just about every aspect of our professional lives as technologists.
WebAssembly will impact the worlds of client-side web development,
desktop and enterprise applications, server-side functionality, legacy
modernization, games, education, cloud computing, mobile
platforms, Internet of Things (IoT) ecosystems, serverless and
microservices initiatives, and more. I hope to convince you of this
over the course of this book.
Our deployment platforms are more varied than ever, so we need
portability at both the code and application levels. A common
instruction set or byte code target can make algorithms work across
various environments because we just need to map logical steps to
how they can be expressed on a particular machine architecture.
Programmers use application programming interfaces (APIs) such as
OpenGL,2 POSIX,3 or Win324 because they provide the functionality
to open files, spawn subprocesses, or draw things to the screen.
They are convenient and reduce the amount of code a developer
needs to write, but they create a dependency on the presence of
libraries to provide the functionality. If the API is not available in a
target environment, the application will not run. This was one of the
ways Microsoft was able to use its strength in the operating system
marketplace to dominate in the application suite space as well. On
the other hand, open standards can make it easier to port software
into different environments.
Another issue with the runtime side of the software we are building
is that different hosts have different hardware capabilities (number
of cores, presence of GPUs) or security restrictions (whether files
can be opened or network traffic can be sent or received). Software
often adapts to what is available by using features-testing
approaches to determine what resources an application can take
advantage of, but this often complicates the business functionality.
We simply cannot afford the time and money needed to rewrite
software for multiple platforms constantly. Instead, we need better
strategies for reuse. We also need this flexibility without the
complexity of modifying the code to support the platform on which it
will run. Making the code different for different host environments
increases its complexity and complicates testing and deployment
strategies.
After several decades, the value proposition of open source software
is clear. We gravitate toward valuable, reusable components written
by other developers as a means of satisficing our own needs.5
However, not all available code is trustworthy, and we open
ourselves up to software supply chain attacks when we execute
untrusted bits we have downloaded from the internet. We become
vulnerable to the risks, business impacts, and personal costs of
insecure software systems through phishing attacks, data breaches,
malware, and ransomware.
Until now, JavaScript has been the only way to solve some of these
problems. When it is run in a sandboxed environment, it gives us
some manner of security. It is ubiquitous and portable. The engines
have gotten faster. The ecosystem has exploded into an avalanche of
Another random document with
no related content on Scribd:
several of the older authorities, namely, Zeuxis, Heraclides, and
Glaucias, some of whom refer it to a younger Hippocrates, some to
Thessalus, others to Polybus, and others again to Democritus.[236]
Accordingly, the highest modern authorities, as Mercuriali, Gruner,
Ackerman, Kühn, and Littré, refuse to receive it into the list of
genuine works; and the last of these seems to make it out pretty
clearly that the treatise is composed of detached observations
extracted from the other Hippocratic works. After repeated perusals
of it, what strikes myself is, that it bears a close resemblance to the
treatise “On the Surgery,” that is to say, that it is a recapitulation of
the conclusions arrived at in certain of the other works of
Hippocrates. Perhaps, then, it must be admitted that there is some
inconsistency in allowing the one a place among the genuine works
of Hippocrates, and refusing the similar claims of the other. That the
work in question contains a most interesting summary of what were
regarded, in ancient times, as great medical truths, cannot be
doubted. From the condensed form in which the subject matters of it
are presented, it will readily be apprehended that they do not well
admit of being given in the form of an abstract, and that any
specimens of its contents will afford but a very imperfect idea of its
value as a whole. I would remark, at the outset, that the title of the
work, “On the Humors,” appears not very applicable, since very few
of the paragraphs relate to the humors; in fact, as already hinted,
the treatise may be said to be a recueil of various observations
gathered out of other works. I also feel at a loss to account for M.
Littré’s disposition to rank it as the eighth book of the Epidemics, as
it bears no resemblance either in form or matter to that work; the
one consisting of isolated observations and of particular facts, and
the other of general principles; and the style of the one being
comparatively full, whereas the other is remarkably succinct, so as to
be nearly unintelligible in many places. Take the following as a
specimen of it: “The earth is to trees what the stomach is to
animals; it nourishes, heats, and cools; cools when emptied, heats
when filled, as the earth when manured is hot in winter, so is it with
the stomach.” This important observation, that the earth, in
connection with the vegetable productions, is analogous to the
stomach in animals, is repeated by Aristotle and other of the ancient
philosophers.[237] The author makes the important remark, (§ 14,)
that we ought to study the condition of the body previous to the
season in which the disease broke out; in confirmation of which M.
Littré, in his arguments, gives some very interesting observations by
M. Forster.[238] In the paragraph on deposits, the author remarks,
that in fevers attended with a feeling of lassitude, the deposits
generally take place to the joints and jaws. It is afterwards stated—
and if confirmed by experience, as I think I have observed it to be in
many cases, it is an important remark—that “when the feet are hot,
the depositions point downwards, but when cold, upwards.” § 7. In §
12 diseases are thus classified: “with regard to the modes of
diseases, some are congenital, as may be learned upon inquiry;
some are connected with the nature of the locality, (for many are
affected, and therefore many are acquainted with them); some with
the condition of the body and the diet, the constitution of the
disease, and the seasons. The localities which are ill situated in
respect to the seasons engender diseases similar to the season; in
like manner, irregularities as to heat and cold in the same day when
it has such effects, produce autumnal diseases in the locality, and in
the other seasons likewise. The diseases which are engendered by
fetid and marshy waters are calculus and splenic diseases, and such
are influenced by good or bad winds.” Altogether, as will be readily
seen, it is a work of great ability, and will amply repay a diligent
perusal. Galen esteemed it very much, and did not hesitate to
declare that, not only Plato, Aristotle, and Theophrastus, but also
several of the most distinguished medical authors had copied freely
from it.[239]
LI. Παραγγέλιαι—Precepts.
This little tract stands altogether in much the same circumstances
as the preceding one, that is to say, it is wholly destitute of all good
authority in its favor, and the nature of its contents is what might
rather be expected from a sophist than a practical physician. The
text, moreover, is in a most unsatisfactory state. I shall dismiss it
then with a very brief notice. It opens with an advice to the
physician not to trust to speculation but to rational experience. He
ought to learn remedies from all quarters, even from the vulgar, and
not be avaricious in his dealings with the sick, more especially if
strangers and needy. The author alludes, as Schulze thinks, to the
practice then followed by the physicians of migrating from one city
to another, and of making a public declaration of their pretensions at
their first entry into any place. These physicians were called
periodeutæ. The author of this tract advises the physician, in such a
case, not to make any vainglorious or inflated profession of his
abilities. He also enjoins the medical practitioner to look to the
health of those who are free from disease, as well as those who was
indisposed.
“Fire being compressed produces air, and air water, and water
earth: and from earth the same circuit of changes takes place till we
come to fire.”[279]
“In that part of the universe where Nature and Generation exert
their powers, it is necessary that there should be these three things:
In the first place, that thing which being tangible furnishes a body to
everything which comes into existence. This is the universal recipient
and substance of impression for things generated, bearing the same
relation to things which are generated from them that water does to
juice, and silence to sound, and darkness to light, and materials to
the things fabricated from them. For water is void of taste and
quality, bearing the same relation to sweet and bitter, and to sharp
and salt. The air is unformed as to sound, or speech, or melody. And
darkness is devoid of color and shape, and bears the same relation
towards bright, and yellow, and white. But white bears reference
also both to the statuary art and that which forms figures of wax.
But matter admits of another comparison with the art of statuary.