Giter Club home page Giter Club logo

stompbox's Introduction

stompbox

Working out various protability senarios from a post by Lin Clark (https://hacks.mozilla.org/2019/08/webassembly-interface-types/)

NOTES

WebAssembly has 2 priniciples baked into it: portability and security.

Uses WebAssembly Interface types - addresses the need for communication with WebAssembly to extend past "talking" in numbers.

  • When JS and WebAssembly try to talk to each other they currently end up using different types.
  • Translation was/is needed to turn an array of numbers into a string and then back into numbers (wasm-bindgen and emscripten's Embind - these automatically create the js glue code to do this translation)

WebAssembly is an assembly language for a conceptual machine, not a physical one. This is why it can be run across a variety of different machine architectures.

WebAssembly Reference Types proposal is a way to solve the translation complexity challanges by introducing anyref. That way consumers can pass over a pointer to an object and WASM can just pass that along to other JS functions.

For more complex types WebIDL bindings are used. This provides a mapping from JavaScript types to WebIDL but currently there is no mapping from WebAssembly types to WebIDL (i.e. WASM x String (JS) -> DOMString (WebIDL), etc...)

Solution is to create a direct mapping from WASM to WebIDL. See WASM GC Proposal - with that WASM will be able to construct complex objects like structs or arrays

Benefits

Using WebAssemlby "Native" modules we can get the benefits of speed without the complexity of target device compilation.

Provides lightweight sandboxing (Code cannot talk directly to the OS) by default to increase the security of the consuming applications (WASI - WebAssembly System Interface).

References

WA Reference types proposal: https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md#language-extensions

WASI: https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/

WebIDL bindings: https://developer.mozilla.org/en-US/docs/Mozilla/WebIDL_bindings

WASM GC Proposal: https://github.com/WebAssembly/gc

stompbox's People

Contributors

nickfloyd avatar

Stargazers

Kevin Bjorke avatar

Watchers

James Cloos avatar Kevin Bjorke avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.