Expand description
The Tuple value descriptor (§4.5 structural tuples).
A tuple is an anonymous, positional product: a fixed number of elements, each
a GcRef, in source order. Unlike records (§4.5) tuples carry no field names
— identity is the element-type sequence alone (so (Int, Int) and (Int, Bool)
are distinct, and (Int, Int) is one shape regardless of where it appears).
Each distinct tuple shape (element descriptor sequence) gets a
TupleSchema. The schema is leaked to &'static (one per shape) because a
tuple’s descriptor callbacks need a type-stable home for the element
descriptors; this mirrors how the codegen leaks RecordSchema and function
names.
The descriptor dispatches element-wise through the schema (§11.4) — there are
no scattered type switches. A single TUPLE-shaped descriptor serves every
tuple because the per-shape knowledge lives in the schema referenced from the
payload. Structural equality and hashing (§5.5) recurse element-wise; a tuple
is equatable/hashable iff every element is. The ordering a container imposes
(ADR-138) recurses the same way — a Map[(Int, Int), V] walks its keys
element-wise — which is a different question from the source-level <, and
(1, 2) < (1, 3) is still refused at check time.
Structs§
- Tuple
Payload - The
Tuplepayload: a pointer to the static schema plus the element values (oneGcRefper element, in schema order). - Tuple
Schema - The static shape of a tuple: an ordered list of element descriptors (positional,
no names). Leaked to
&'staticonce per distinct shape by the codegen.
Statics§
- TUPLE
- Descriptor for the
Tuplevalue type (§4.5). Structural equality, hashing (§5.5) and the container ordering (ADR-138) all recurse element-wise through the per-shape schema’s element descriptors. A tuple is equatable/hashable iff every element is; functions never are, so a tuple containing a function is neither.
Functions§
- point_
schema - The cached
'staticschema for a(Int, Int)point tuple. Used by Grid methods that return(x, y)points (§6.4). Built once and leaked; the two element descriptors are bothINT. This avoids the codegen round-trip for tuple schemas when the runtime allocates points directly.