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

Chris Lattner clattner at apple.com
Sun Jan 31 22:49:42 CST 2016


> On Jan 31, 2016, at 5:00 PM, Kevin Ballard via swift-evolution <swift-evolution at swift.org> wrote:
> 
> +1 in general, though I do wonder how this change will affect generic code. For example, if I have a function that returns a tuple, and another function that takes an argument list matching the same tuple type, can I still use generic functions like map() to call the second function with the tuple from the first? I'm hoping the answer is "yes", because the type of a function doesn't distinguish between functions that take multiple arguments vs functions that take a single argument of tuple type and so passing functions around as first-class values should be fine. Although I imagine this change will still prevent me from writing a closure like { funcOfTwoArgs($0) } which is unfortunate, but would be solved by a subsequent proposal to add an explicit splat operator.

Yes, AFAIK, generic code isn’t affected by the proposed change.  Type checking of generic code is modular, not aware of the concrete types the generic is instantiated with.

-Chris



More information about the swift-evolution mailing list