[swift-evolution] ternary operator ?: suggestion

Jordan Rose jordan_rose at apple.com
Sat Dec 19 21:55:49 CST 2015


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.

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



More information about the swift-evolution mailing list