Open radu-matei opened 2 years ago
I certainly agree that building language SDKs out of the generated C bindings would be extremely hard to maintain.
In addition to the proposed intermediate C SDK idea, I want to offer some alternatives:
wit-bindgen
to add more language bindings is the obvious and ideal way, but it's cost to engineering efforts is no joke. I would be willing to contribute to wit-bindgen to support more guest langauges, but I understand this is unreal to acheive in the short term. I also support your move, but I, too, would suggest we collaborate as a community to add go bindings to wit-bindgen. I get the problem, however.
Adding Go support to WIT bindgen would be amazing, and we're happy to help that effort! This is not trying to replace or make that effort obsolete.
Having an intermediate (C or Rust) SDK would help if we want to support other languages we that don't have yet support, plans, or bandwidth to support directly in WIT bindgen.
(I doubt we'll have for example Swift support in WIT bindgen, but it would be pretty cool to support it in Spin beyond a Wagi component.)
sounds great to me.
The call out for standard objects would be helpful. Currently running into issues with Zig which does not have a fully implemented std http package. Http packages that I have been using ultimately rely on net.Address which uses Sock.Addr under the hood. When targeting WASI, the Sock.Addr functions are not implemented ( related to WASI socket support ) My current path is to build a light weight http library that does not leverage net.Addr to get around this ( i.e - just the http objects )
(I doubt we'll have for example Swift support in WIT bindgen, but it would be pretty cool to support it in Spin beyond a Wagi component.)
That is a good point! Do you have a list of languages you want to support in mind? I would suggest adding as much mainstream languages as possible: C#, Js (Ts), Python, Java, Swift, and C++
Spin currently supports two language SDKs — Rust and Go. While the two SDKs have feature parity, the way they are implemented is very different:
As we try to build more Spin SDKs for languages that don't currently have WIT bindgen support, we expect to see a few issues with individually generating the same C bindings for each project:
A lot of these issues would be either simplified or entirely avoided if we had an intermediate C SDK that aggregated all bindings, and had a common representation for the objects used (HTTP objects, for example) for languages that needed to interop with the C bindings.
Then, the Go and future SDKs would depend on this friendlier SDK rather than on the lower level auto-generated bindings.
Thoughts?