[Discussion] Determining argument count from context

[1,2,3].reduce(0) { $1 } //=> 3
[1,2,3].reduce(0) { $0 } // error :(

Am I requesting too much from type checker?
Will recent function type proposals resolve the issue?

This is filed here:

    [SR-586] $0 captures all closure argument as single tuple when no larger-numbed $N used · Issue #43203 · apple/swift · GitHub

There was some discussion about it on the list about whether this is a bug or a dubious feature. Douglas Gregor recently weighed in on that:

I consider this a bug. The removal of implicit tuple splats should, IMO, encompass making $0 consistently capture the first argument. I’d love for this to happen in Swift 3.

https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160627/022448.html

Cheers, P

···

On Jul 3, 2016, at 4:04 PM, Anton Zhilin via swift-evolution <swift-evolution@swift.org> wrote:

[1,2,3].reduce(0) { $1 } //=> 3
[1,2,3].reduce(0) { $0 } // error :(

Am I requesting too much from type checker?
Will recent function type proposals resolve the issue?

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

[1,2,3].reduce(0) { $1 } //=> 3
[1,2,3].reduce(0) { $0 } // error :(

Am I requesting too much from type checker?
Will recent function type proposals resolve the issue?

Yes, I believe this should be fixed with SE-0110, if accepted

···

On 04.07.2016 0:04, Anton Zhilin via swift-evolution wrote:

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution