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

David Goodine dmgoodine at gmail.com
Wed Oct 26 06:46:56 CDT 2016


-1 as well, particularly agreeing with Rimantas that removing something of use because it confuses new programmers is not a good motivation.  To paraphrase Einstein, “A programming language should be as simple as possible, but no simpler.”

-d

> On Oct 26, 2016, at 6:26 AM, Rimantas Liubertas via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 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.
> 
> -1
> 
> A lot of things can and will be confusing for newcomers, that's not the reason to remove them. Being a newbie is a transitional state.
> OTOH, I've never got why ternary is considered especially confusing, for me it never was a problem and I love the terseness of it.
> Only total novices in programming may be surprised by it, but they will be suprised by a lot of things anyway, so ternary is the least of their problems. Those with experiene in other languages will be most likely already familiar with the
> operator.
> Also, many come to Swift from Objective C, which not only has ternary, but also supports a variant where you can use it kind of like ?? in Swift: NSString *other = someString ?: @"default string".
> 
> Removing ?: gains nothing and loses a lot, I'd say.
> 
> Best regards,
> Rimantas
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

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


More information about the swift-evolution mailing list