Stream: general

Topic: Is there a *.wit format explainer?


view this post on Zulip akesling (Apr 03 2022 at 19:27):

Hey all,

I'm interested in surfacing an API from a Rust host to a given Wasm guest program. Wasmtime looks like a good fit for my host engine. For the API encoding/schema, I've been trying to catch up on the last few years of discussion/progress on WebAssembly Interface Types, WebAssembly Components, Canonical ABI, etc. and am a touch confused as to the "recommended" path forward _today_. I understand that everything is still in flux, so I figured I'd ask directly and see if anyone has a "current" answer:

1) Is wit-bindgen + *.wit files the currently recommended tooling for "encoding" an API between a Wasmtime host and guest and providing the language-specific generated code?

2) If *.wit is the format of record for encoding this API, is there a good IDL explainer (akin to this one for flatbuffers or this one for protobuf?) as to how to write a schema file?

I've looked at the WebAssembly Interface Types explainer but everything there is written in S-expressions and framed in terms of low level semantics instead of being a high-level introduction to the schema that I see wit-bindgen accepting.

I'm hopeful that I've just overlooked something obvious. My apologies if my Google-fu was weak.

Any help would be greatly appreciated. Thank you.

A language binding generator for WebAssembly interface types - GitHub - bytecodealliance/wit-bindgen: A language binding generator for WebAssembly interface types
This guide describes how to use the protocol buffer language to structure your protocol buffer data, including .proto file syntax and how to generate data access classes from your .proto files. It covers the proto3 version of the protocol buffers language: for information on the proto2 syntax, see the Proto2 Language Guide.
Contribute to WebAssembly/interface-types development by creating an account on GitHub.

view this post on Zulip Dan Gohman (Apr 05 2022 at 01:53):

1) Yes. 2) This is a pretty good intro, though note that some parts of the system are still evolving, so please ask here, or file an issue, if something doesn't work. There are also some examples in the wit-bindgen tree, wasi-filesystem is another.

WebAssembly and WASI show great promise for the future of computing outside the browser, and the WebAssembly component model aims to improve the portability, cross-language, and composition story for Wasm. This article explains the goals of the component model, and showcases how to use tooling from the Bytecode Alliance to build and consume such components.
Filesystem API for WASI. Contribute to WebAssembly/wasi-filesystem development by creating an account on GitHub.

view this post on Zulip Albert Cervin (May 03 2022 at 17:10):

Amazing, I had exactly the same set of questions and this answers it, lots of confusing/outdated/contradicting information floating around :smile:


Last updated: Dec 23 2024 at 12:05 UTC