Stream: wit-bindgen

Topic: Tuples for languages without tuples


view this post on Zulip Slava Kuzmich (Jun 23 2024 at 10:27):

Guest bindgen for Kotlin (has generics, but no vararg T) uses standard Pair<A, B> and Triple<A, B, C> tuple types, and generates Tuple{4+} types at the world level. Other built-in WIT types can be provided as a library, but these TupleN stands-off as the only type generated this way.

I am wondering if this could be improved. Does anybody know use-cases for the large tuples? The benefit of discouraging large tuples, would be that bindgens could implement a limited set of Tuple{1..N} statically, and fall back to something like List<Any> for larger tuples. Limiting tuple size at the spec level would simplify bindings even more.

These TupleN are currently also used for multi-value results, and would also benefit from this.


Last updated: Dec 23 2024 at 12:05 UTC