Konubinix' opinionated web of thoughts

WebAssembly

fleeting

https://hacks.mozilla.org/2017/02/creating-and-working-with-webassembly-modules/

web platform can be thought of as having two parts:

  • A virtual machine (VM) that runs the Web app’s code, e.g. the JavaScript code that powers your apps.
  • A set of Web APIs that the Web app can call to control web browser/device functionality and make things happen (DOM, CSSOM, WebGL, IndexedDB, Web Audio API, etc.).

https://developer.mozilla.org/en-US/docs/WebAssembly/Concepts

Historically, the VM has been able to load only JavaScript.

https://developer.mozilla.org/en-US/docs/WebAssembly/Concepts

WebAssembly is a different language from JavaScript, but it is not intended as a replacement. Instead, it is designed to complement and work alongside JavaScript,

https://developer.mozilla.org/en-US/docs/WebAssembly/Concepts

JavaScript is a high-level language, flexible and expressive enough to write web applications.

https://developer.mozilla.org/en-US/docs/WebAssembly/Concepts

WebAssembly is a low-level assembly-like language with a compact binary format that runs with near-native performance and provides languages with low-level memory models

https://developer.mozilla.org/en-US/docs/WebAssembly/Concepts

virtual machine that we talked about earlier will now load and run two types of code — JavaScript AND WebAssembly.

https://developer.mozilla.org/en-US/docs/WebAssembly/Concepts

different code types can call each other as required

https://developer.mozilla.org/en-US/docs/WebAssembly/Concepts

WebAssembly cannot currently directly access the DOM; it can only call JavaScript,

https://developer.mozilla.org/en-US/docs/WebAssembly/Concepts

to access any Web API, WebAssembly needs to call out to JavaScript, which then makes the Web API call.

https://developer.mozilla.org/en-US/docs/WebAssembly/Concepts

Emscripten therefore creates the HTML and JavaScript glue code needed to achieve this.

https://developer.mozilla.org/en-US/docs/WebAssembly/Concepts

Emscripten implements popular C/C++ libraries like SDL, OpenGL, OpenAL, and parts of POSIX. These libraries are implemented in terms of Web APIs and thus each one requires some JavaScript glue code to connect WebAssembly to the underlying Web API.

https://developer.mozilla.org/en-US/docs/WebAssembly/Concepts

part of the glue code is implementing the functionality of each respective library used by the C/C++ code

https://developer.mozilla.org/en-US/docs/WebAssembly/Concepts

glue code also contains the logic for calling the above-mentioned WebAssembly JavaScript APIs to fetch, load and run the .wasm file.

https://developer.mozilla.org/en-US/docs/WebAssembly/Concepts

pronunciation

WebAssembly (abbreviated WASM, pronounced waz-um)

https://matt-rickard.com/what-is-webassembly

(Wasm should be pronounced like awesome starting with a W ).

https://github.com/petersalomonsen/wasm-git

WebAssembly, when you read Wasm. Is it wah-sum, w-a-s-m, or do you just read ‘web assembly’?

wah-sum

https://users.rust-lang.org/t/pronunciation-of-things-from-rust/54744?page=2

we expect that developers are going to use both WebAssembly and JavaScript in the same application

https://hacks.mozilla.org/2017/02/creating-and-working-with-webassembly-modules/

WebAssembly is a little bit different than other kinds of assembly. It’s a machine language for a conceptual machine, not an actual, physical machine.

https://hacks.mozilla.org/2017/02/creating-and-working-with-webassembly-modules/

another tool called Emscripten which is a bit easier to use at the moment. It has its own back-end that can produce WebAssembly by compiling to another target (called asm.js) and then converting that to WebAssembly. It uses LLVM under the hood, though, so you can switch between the two back-ends from Emscripten.

https://hacks.mozilla.org/2017/02/creating-and-working-with-webassembly-modules/

Notes pointant ici