Closed omersadika closed 11 months ago
A named tuple type is a record
. The syntax for a tuple, in wit, is e.g. tuple<u32, s32, string>
Functions can return multiple types by naming them. Despite using a syntax like tuples use in some languages, this is distinct in the type system from a tuple or a record: https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md#wit-functions
Thanks @pchickey!
The significant difference is that you don't have to define tuples unlike records, and in some cases creating many records makes it complex. If there is no way to achieve that probably tuples without names will be the simplest solution.
Today I can have multi-return named type in functions in WIT:
Many times, I will use it together with result, but when I do it, I can't return named type anymore, only tuples, so I want to do something like that:
It is very similar to tuples with the named tuple, but can be used outside of function. Is there any way to achieve that? Maybe a way to name tuple types?