[swift-evolution] Proposal: Make $0 always refer to a closure’s first argument

Chris Lattner clattner at apple.com
Wed Jan 20 16:55:08 CST 2016


On Jan 20, 2016, at 9:49 AM, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> I wouldn't go as far as to say it's a bug. It's known and occasionally useful for forwarding arguments. (For a while I had it as a fix-it for doing function representation conversions.)
>> 
>> I agree that having it always be the first argument is less surprising and probably more generally useful, though.
> 
> In the spirit of the Great Argument Simplification to distinguish arguments from tuples, we probably ought to introduce a separate '$*'-like sigil to bind "all arguments" distinct from $0.

Likewise, on the caller side, we should have a “splat” sigil to splat a tuple into the argument list of a call.  We need a similar thing for varargs to enable vararg forwarding as well.

-Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160120/c80f752b/attachment.html>


More information about the swift-evolution mailing list