[swift-evolution] [Proposal] Automating Partial Application via Wildcards

Dave Abrahams dabrahams at apple.com
Tue Feb 2 12:56:56 CST 2016


on Tue Feb 02 2016, Gwendal Roué <swift-evolution at swift.org> wrote:

> What about nothing?
>
> let partial1 = f(arg1: 1, arg2:)

Other systems have used “_”, and, for reordering parameters, “_0”,
“_1”, ...

let partial1 = f(arg1: 1, arg2: _) // { f(arg1: 1, arg2: $0) }
let partial2 = f(arg1: _1, arg2: _0) // { f(arg1: $1, arg2: $0) }

> Gwendal
>
>> Le 2 févr. 2016 à 19:26, Gwendal Roué <gwendal.roue at gmail.com> a écrit :
>> 
>> Any operator character would be bad, since the function may accept
>> it, as in `[1,2,3].reduce(1, combine: *)`
>> 
>> Gwendal
>> 
>>> Le 2 févr. 2016 à 19:24, Erica Sadun via swift-evolution
>>> <swift-evolution at swift.org> a écrit :
>>> 
>>> 
>>>> On Feb 2, 2016, at 11:20 AM, Chris Lattner
>>>> <clattner at apple.com> wrote:
>>>> 
>>>> On Feb 2, 2016, at 10:16 AM, Erica Sadun
>>>> <erica at ericasadun.com> wrote:
>>>>>> 
>>>>>> One superficial comment on this: the use of _ here is a bad
>>>>>> idea.  _ already means something in expressions - “discard”, and
>>>>>> a closely related thing in declarations - “ignore”.
>>>>>> 
>>>>>> Adding a third very different thing (placeholder to be filled in
>>>>>> later) seems like a really confusing thing to do.
>>>>>> 
>>>>>> -Chris
>>>>>> 
>>>>> 
>>>>> 
>>>>> #?
>>>> 
>>>> # means “macro like” or “compiler synthesized”.
>>>> 
>>>> -Chris
>>>> 
>>> 
>>> * would be bad, right? And naked ?-marks?
>>> 
>>> -- E
>>> 
>>> _______________________________________________
>>> swift-evolution mailing list
>>> swift-evolution at swift.org
>>> https://lists.swift.org/mailman/listinfo/swift-evolution
>> 
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-- 
-Dave



More information about the swift-evolution mailing list