[swift-evolution] ternary operator ?: suggestion

Chris Lattner clattner at apple.com
Thu Dec 17 00:44:29 CST 2015

+Doug for his thoughts on the web page:

> On Dec 16, 2015, at 10:01 PM, J. Cheyo Jimenez <cheyo at masters3d.com> wrote:
> Thank you Chris for all the feedback. 

To be clear, I’m not completely opposed to a change here, but it has been discussed extensively before, and didn’t turn up any good ideas either.  That doesn’t mean that a good idea isn’t out there - it might be a very hard problem (of course, it really might be that ?: cannot be beat just because it is established, and anything as good as it but different would be considered “weird and not better”).

> Should there be a spot on the website or github with frequent proposed changes that are not feasible or that not better solution has been found (such as the ?: operator )?

> I am thinking this would cut down on people asking to turn operators into keywords (or similar ) but still encourage better solutions to be proposed. 

I think it is a really interesting idea to have a list of “commonly proposed changes” on the Swift evolution web page, with a link to the discussion archives for it.  While it shouldn’t be verboten to explore an area in the future, anyone doing so can reasonably be expected to read the previous discussions and only reopen it if there is new information or a new idea.

What do you think Doug?


> On Wednesday, December 16, 2015, Chris Lattner via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> > On Dec 16, 2015, at 7:36 PM, Charles Constant <charles at charlesism.com <javascript:;>> wrote:
> >
> > One more thought. This syntax would also placate ternary haters. I think the traditional complaint about ternary expressions is that people can't remember the order of the true and false values. This would not be an issue with:
> >
> >  let i = boo ? ( true: 123, false: 456 )
> I would characterize this as “different” than ?:, but not better.  Given that it isn’t “better”, I’d argue that following C (and tons of other languages) would make sense here.
> -Chris
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <javascript:;>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>

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

More information about the swift-evolution mailing list