[swift-evolution] ternary operator ?: suggestion
Chris Lattner
clattner at apple.com
Tue Dec 15 15:38:20 CST 2015
> On Dec 15, 2015, at 8:39 AM, J. Cheyo Jimenez via swift-evolution <swift-evolution at swift.org> wrote:
>
> Thank you Paul for the initial draft.
>
> Here is the a draft version that I intend to submit.
>
> https://github.com/masters3d/swift-evolution/blob/ReplaceTernary/proposals/00-Replace%20%3F:%20Ternary%20Operator%20with%20if-then-else%20expression.md <https://github.com/masters3d/swift-evolution/blob/ReplaceTernary/proposals/00-Replace%20%3F:%20Ternary%20Operator%20with%20if-then-else%20expression.md>
Random comment, but in your code examples like this:
let color = (if stop then Color.red else Color.green)
I’d suggest including the existing ternary version. The proposal is really about replacing ternary with this syntax, so it should show the “before and after”, not just the after. Your pitch is that code will look better / be easier to read if this proposal goes through, so you should demonstrate that.
-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151215/a890811e/attachment.html>
More information about the swift-evolution
mailing list