[swift-evolution] Revisiting SE-0110

Stephen Celis stephen.celis at gmail.com
Tue Jun 6 19:43:30 CDT 2017


> On Jun 6, 2017, at 8:19 PM, Mark Lacey <mark.lacey at apple.com> wrote:
> 
> Thanks for reminding me. It’s good to call out this case specifically. The underlying reason that this is disallowed for Swift 4 is the same as the underlying reason that a closure immediately passed as an argument (with with mismatching function type) is disallowed for Swift 4 (i.e. the “tuple destructuring” case). It might be possible to relax restrictions to allow one of these without allowing the other.
> 
> Having said that, I find it surprising that your tupleUp function works as it is implicitly converting the function type in a way that I would expect SE-0110 to disallow. My expectation is that it would need to be written like this:
> 
> func tupleUp<A, B, C>(_ f: @escaping (A, B) -> C) -> ((A, B)) -> C {
>  return { f($0.0, $0.1) }
> }

Ah yes. I was distracted while writing that reply and didn't finish the implementation. That looks right, thanks!

I definitely understand the ambiguity issue but there was something nice about being able to think of arguments as tuples. I just wish the disambiguation could have operated in the opposite direction.

Stephen


More information about the swift-evolution mailing list