Skip to main content
v0.14.0

Tuples cannot implement an aspect

Gap​

Tuple types have no standard blanket aspect implementations, and a local aspect cannot be implemented for a tuple target (extend (i64, i64): MyAspect { … } does not work). Arrays are the exception, through the orphan-rule carve-out for structural type constructors, and anonymous records now are too: a local aspect can be implemented for a record target, closed or row-tailed (extend { w: i64 }: MyAspect, extend<row R: { w: i64, .. }> { ..R }: MyAspect; RFC-0121 §3, metel-core#1306 item 8). The Language Spec defers tuples pending a decision between per-arity boilerplate and variadic generics.

Impact​

A tuple satisfies no aspect that requires an implementation, so it cannot be printed, compared or passed where such a bound is required. extend (i64, i64): Show { … } is rejected with T0001 ("cannot extend a tuple type"), and the diagnostic hints at using a named struct instead. Auto-derived aspects are unaffected.

Affects​

Resolution​

Records: resolved by metel-core#1306 item 8. Tuples: planned for v0.14.0, tracked as metel-core#239.