[swift-evolution] Proposal: Always flatten the single element tuple

Stephen Celis stephen.celis at gmail.com
Wed Jun 7 07:40:37 CDT 2017


> On Jun 7, 2017, at 8:27 AM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
> 
> Swift package descriptions make extensive use of enums. For example, .target(...) is an enum case with an associated value, unless I’m mistaken. I too got the order of “dependencies” and “path” reversed the other day; if enum associated values were tuples, then it would not have mattered. I assume this is what you were referring to above.

Enum associated values are isomorphic to tuples. Function arguments are also isomorphic to tuples. You're referring to a specific ordering issue that exists in both enum cases with multiple associated values, functions arguments (like a struct initializer), and tuples.

> An arbitrary argument list cannot be represented as a tuple. For example, tuples cannot have elements of variadic type or inout type.

Modifiers like throws/inout/@escaping affect the body of the function and are arguably erasable in the data structure itself.

Variadic tuples are disallowed but not an impossible concept (and supporting them hasn't been ruled out as far as I can remember).

> Slow, and especially inconsistently slow, performance fits the definition of unreliable, wouldn’t you agree?

Again, trade-offs and openness to exploring better solutions.

> They are not.

Other than the function body modifiers, how are they not?

Stephen



More information about the swift-evolution mailing list