[swift-evolution] ternary operator ?: suggestion

Dave Abrahams dabrahams at apple.com
Sat Dec 19 21:57:47 CST 2015


> On Dec 19, 2015, at 7:55 PM, Jordan Rose via swift-evolution <swift-evolution at swift.org> wrote:
> 
> It's a nice, consistent proposal, but I don't feel like this solves any of the complaints about the existing ternary operator:
> 
> - It's not obvious what it does when you first learn it.
> - The '?' doesn't have anything to do with Optionals.
> 
> It is a way to put 'switch' into an expression. I'm not a fan of the two different colons, but that's "just" syntax.

+1 to all that

> Jordan
> 
>> On Dec 18, 2015, at 14:04 , Paul Ossenbruggen via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> All,
>> 
>> I think, I finally might have the answer to improving ternary, with such a bold statement come some pretty high expectations but I think, I might actually have done it this time :-)
>> 
>> I am calling it the Demux Expression, it builds on the benefits of ternary and switch while improving on those. 
>> 
>> https://github.com/possen/swift-evolution/blob/master/proposals/0024.md
>> 
>> This is a first draft, thanks in advance for feedback!
>> 
>> - Paul
>> _______________________________________________
>> 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