Skip to content

Commit

Permalink
doc: explain the min/max amount of tuple elements
Browse files Browse the repository at this point in the history
Clarify why tuples must contain between 2 and 12 types, especially the
arbitrary limit of 12 elements.
  • Loading branch information
dnaka91 committed Nov 5, 2023
1 parent 66b95bf commit 5e74489
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion book/src/schema/tuples.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

Tuples allow for the definition of a set of types, without having to define an explicit struct for it. These do not have any associated [ID](index.md#identifiers), meaning the order of declaration matters, and any modification to the type definition is generally incompatible.

The maximum amount of types in a tuple are **12**.
The minimum amount of types in a tuple are **2** and the maximum are **12**. Reasons for this choice are:

- A tuple with 0 types is empty and can't carry any data.
- Having only 1 type is equivalent to the contained type itself and is redundant.
- Up to 12 types seems arbitrary, but having more than 3 or 4 types often calls for defining an explicit struct with field names for better clarity.

## Schema

Expand Down

0 comments on commit 5e74489

Please sign in to comment.