Skip to content

Limit tuple sizes to N (~16?) elements #373

Open
@rvolosatovs

Description

@rvolosatovs

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions