ADR-253: A List Has No +, and extend Is How Two Lists Join

Status: Accepted Date: September 29, 2026 Answers: docs/open-decisions.md’s Whether + joins two lists — the owner chose no operator on a list, and the refusal stays Related: ADR-081 (+ over text, the operator this is weighed against), Part I 4.5 (a list is given no operator)

1. Context

[1] + [2] is NK1191, whose help names the way that works, a.extend(b); without it rustc says cannot add Vec<i64> to Vec<i64> about a file nobody wrote. Whether to give a list + was open because an operator on a type Part I 4.5 gives none is the owner’s to add.

Two answers were on the page: + on two lists of one element type makes a new list, as + on text makes new text (ADR-081); or no operator, and the refusal stays.

2. Decisions

D1 — A list has no +

a + b on two lists is refused with NK1191, as every other arithmetic operator on a list, a map or a set is. Its note says Lists have no operators: + doesn’t join two lists.

D2 — a.extend(b) is how one list’s elements join another

Widened by ADR-collections-1 D2-D4: every set has extend too, and it takes a list, a set or a sequence of owned elements.

It grows a in place. A program that wants a third list writes it: let mut c = a.clone(), then c.extend(b).

D3 — Why not +

+ on text is there because text is built up by hand constantly. A list is built with push and extend, and + would allocate a third list where a program usually wants to grow one: xs = xs + [x] in a loop reads like a push and is quadratic. The two ways of being wrong are not the same size — an operator added in error is a slow program nobody notices, a refusal kept in error is lifted later and breaks nothing.

3. Consequences

Part I 4.5 says a list has no operators and names NK1191 and extend.

This site is open source. Improve this page.