[swift-evolution] Proposal: Make $0 always refer to a closure’s first argument
cantrell at pobox.com
Tue Jan 19 22:52:09 CST 2016
> On Jan 19, 2016, at 10:35 PM, John McCall <rjmccall at apple.com> wrote:
>> On Jan 19, 2016, at 7:20 PM, Paul Cantrell via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> It appears that the meaning of $0 is overloaded: it can refer either to the tuple of all arguments, or to just the first argument. The presence of another placeholder variable ($1 in the third example) seems to trigger the latter behavior.
> It’s dumber than that. The type-checker assumes that the closure has a tuple of arguments ($0, $1, …, $N), where $N is the largest N seen in the closure. Thus, a two-argument closure falls down if you ignore the second argument. It’s dumb, and we’ve known about it for a long time; and yet it’s been remarkably annoying to fix, and so we haven’t yet.
> Anyway, it’s a bug and doesn’t need to go through evolution.
Roger that. Filed the bug: https://bugs.swift.org/browse/SR-586 <https://bugs.swift.org/browse/SR-586>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution