[swift-evolution] ternary operator ?: suggestion
Thorsten Seitz
tseitz42 at icloud.com
Wed Jan 20 10:22:41 CST 2016
>> Am 20.01.2016 um 02:12 schrieb Chris Lattner <clattner at apple.com>:
>>
>> On Jan 19, 2016, at 3:17 PM, Thorsten Seitz <tseitz42 at icloud.com> wrote:
>>
>>>>
>>>> The big advantage of the partial function proposal would be that it is much more general as it is usable everywhere a unary function argument is used, i.e. for map etc.
>>>
>>> Sure, you’re optimizing for one specific case at the expense of composability. I personally don’t find that compelling, but YMMV.
>>
>> I’m not sure I understand. What specific case do you mean and what composability is lost with the unary function approach?
>
> I’m saying that tying closure expressions and switch expressions together makes it inconvenient when you want a local switch in a non-function context.
I'm sorry, but I'm afraid I still don't understand. Using the global match() function you can easily provide the function context and place the switch locally everywhere an expression is possible.
-Thorsten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160120/c93f06cb/attachment.html>
More information about the swift-evolution
mailing list