[swift-evolution] [Pitch] Replace the ternary operator with an in-language function
Erica Sadun
erica at ericasadun.com
Wed Oct 26 11:54:18 CDT 2016
You and I discussed this at length in iOS Folks, but I'll restate here. I'd be against this proposal. I think it adds unnecessary verbosity vs a simple and elegant representation. As an inherently functional alternative to if-then-else, Swift's ternary form is clear and parsimonious, perfect for simple expressions. Converting to a more laborious syntax takes away these advantages, and I'd be tempted to write my own operators to mimic their functionality rather than use your syntax.
I'm glad you brought the proposal here and thank you for your effort in writing it up.
-- E
> On Oct 25, 2016, at 10:51 PM, Charlotte Angela Tortorella via swift-evolution <swift-evolution at swift.org> wrote:
>
> Preamble: I've read over the threads that already exist about the ternary operator and to be honest they're a complete mess without a single fully formed proposal.
>
> Pitch: I'd like to simplify the syntax, compiler complexity and learning curve for newcomers when it comes to dealing with the ternary function. The best way to do that, in my opinion, is to remove it entirely and add a new function with better semantics that takes care of ternary operations entirely within the Swift language.
>
> gist: https://gist.github.com/Qata/25a11c21200f1cf8f43ed78e9ffd727c <https://gist.github.com/Qata/25a11c21200f1cf8f43ed78e9ffd727c>
>
> Replace the `?:` operator with an in-language function
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161026/88473402/attachment.html>
More information about the swift-evolution
mailing list