[swift-evolution] [Pitch] Replace the ternary operator with an in-language function

David Sweeris davesweeris at mac.com
Wed Oct 26 19:43:47 CDT 2016


> On Oct 25, 2016, at 23:51, Charlotte Angela Tortorella via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Disadvantages of The Ternary Operator
> 
> [...]
> 
> 6. This operator is only applicable to a single type, `Bool`.
> 
> [...]
> 
> Proposed Approach
> 
> We should drop the ternary operator in favor of a new extension to `Bool`.

I'm not sure proposals should do exactly what they claim is a downside of the current approach. Especially when the downside in question is inherent to the problem being solved.

FWIW, the only thing I find confusing about the ternary operator is that I can't overload it. Being able to define my own ternary operators would be great, but I don't have an answer to obvious potential ambiguities.

- Dave Sweeris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161026/aa8ec938/attachment.html>


More information about the swift-evolution mailing list