WebAssembly / WebAssembly/component-model
Limit tuple sizes to N (~16?) elements
Nobody has claimed this yet.
- Dominant language
- WebAssembly
- Stars
- 1.4k
- Forks
- 130
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 15
Description
Currently tuples, as specified, may contain up to 4294967295 (u32::MAX) elements, however that presents challenges for integration, especially in languages that do not have a native tuple type (like Go).
An example Go implementation requires implementing custom tuple types per each length, e.g.:
Even for languages supporting tuples, like Rust, unbounded tuples may present challenges, for example, Default is only implemented on tuples of up to 12 elements: https://doc.rust-lang.org/std/primitive.tuple.html#impl-Default-for-(T,)
Generally, it seems that using tuples containing excessive amount of elements is an anti-pattern, where such data types would be better represented using records.
The suggestion is, therefore, to limit the tuple sizes to a reasonable default, 16 seems to be a reasonable ceiling here. 12 could be another option, which would nicely align with e.g. Rust. (but do note that e.g. wit-bindgen test suite utilizes tuples containing over 12 elements)
Related to #370
cc @alexcrichton
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the linked Go tuple implementation in tuple.go and the wit-bindgen test suite, which currently uses tuples over 12 elements. Determine an appropriate tuple ceiling, such as 16 or 12, and define the specification and test changes needed to enforce it, considering related issue #370.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- wasm
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100