Thursday, June 30, 2022

Go => TinyGo => WASM, WASI

First steps with Golang and WebAssembly - DEV Community

What is the difference between WASM and WASI? In really short WASM is for the web and it doesn't support function calls,

Lots of languages are able to produce WASI
+ WASI modules don't need extra dependencies

have to use TinyGo to compile WASI module

"WASI is an extension of WASM to run not only on the web, but on any platform. WebAssembly provides a build target for a conceptual machine, meaning that a single binary can be run on different processors and computers (rather than having to build multiple different binaries). WASI provides a conceptual operating system which means that a program can use a common set of commands and subroutines to interact with the operating system without needing to be rewritten to handle the differences between operating systems.

If your code only needs to run in the browser you should use WebAssembly. If you are interacting with an operating system in a program you might want to consider using WAS

A description by Mozilla


The WebAssembly System Interface

WASI is a modular system interface for WebAssembly. As described in the initial announcement, it’s focused on security and portability.

WASI is being standardized in a subgroup of the WebAssembly CG. Discussions happen in GitHub issues, pull requests, and bi-weekly Zoom meetings.

For a quick intro to WASI, including getting started using it, see the intro document.

The Wasmtime runtime’s tutorial contains examples for how to target WASI from C and Rust. The resulting .wasm modules can be run in any WASI-compliant runtime.

For more documentation, see the documents guide.

No comments: