[swift-evolution] Proposal: Remove implicit tuple splat behavior from function applications

Janosch Hildebrand jnosh at jnosh.com
Sun Jan 31 12:35:23 CST 2016


+1 to the existing proposal.


On a related note, would this also affect the implicit "argument-list to tuple" conversion?
To give an example:

var array: [(Int, Int)] = []
var int_var = 1
let int_let = 1

// These obviously work
array.append((int_let, 1))
array.append((1, 1))
array.append((int_var, 1))
array.append((int_var, int_var))


// The following have worked to varying degrees over Swift's (public) lifetime
// Currently only the first example compiles
array.append(int_let, int_let)
array.append(int_let, 1)
array.append(1, 1)
array.append(int_var, 1)
array.append(int_var, int_var)

This is in a way the reverse of splatting but IMO equally troublesome at least in it's current form.
And it also presumes some form of equivalence between function argument lists and tuples.

So my question is does the proposal already cover removing this behaviour (in which case +1)?
Or else, could this be added to the proposal or would this need a separate proposal entirely?

- Janosch



More information about the swift-evolution mailing list