Open abrown opened 3 years ago
cc: @pchickey, @sunfishcode, @alexcrichton, @jedisct1
The AssemblyScript/Zig bindings and documentation for wasi-crypto and other APIs were all generated with as-witx. The Rust bindings were generated with witx-generate-raw
.
But none of these code generators support the recent changes made to the witx
format yet.
I don't know what tools other proposals have used to generate their bindings. Some of them (ex: experimental-http
) are manually written.
Before centralizing these bindings, maybe we really need code generators (not only for Rust) that we could all use.
I'm not personally sure where best the bindings for all the proposals to wasi would live, but here seems as best a place as any while we figure that out?
Agreed with Alex that the long term isnt clear, but for now we should start by getting the Rust code generator in this crate working for all proposals. I don't have an opinion on where code generators for other languages should live.
maybe we really need code generators (not only for Rust) that we could all use
@jedisct1, is witx-codegen an attempt to fix this problem? I haven't tried it out yet, but I like the idea of being able to generate bindings for a bunch of different languages! How do you see that tool relating to the current Rust code generator in this repo--should it replace it? Live alongside?
@abrown Yes. witx-codegen
was made to solve this problem, which also affected other non-rust projects as changes to witx were made. It merges existing code and doc generators into a single tool, which is way easier to maintain than all these different forks of as-witx
.
witx-codegen
is currently being updated to use the BindGen
trait in order to support the next ABI, and for the Rust backend, the code from this repository can easily be ported to it instead of exposing a different interface.
I would like to publish Rust bindings for wasi-nn that were generated with the
witx-bindgen
tool in this repo (the Rust bindings currently live in a Wasmtime example). It would be helpful to me to have the bindings in one place--i.e., most likely this repository--so that changes to WITX, the tools, etc., can be tested against bindings from several modules. This would simplify creating and maintaining WASI proposals and there are other WASI proposals (e.g. wasi-crypto, wasi-sockets, etc.) that might benefit from this same idea.The first question is "should this be done?" and I am interested in opinions here. Then, "how?": I think this repository (and accompanying CI tasks) could be slightly refactored to generate and publish multiple crates, one per proposal. Thoughts?