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

Goffredo Marocchi panajev at gmail.com
Wed Oct 26 02:06:41 CDT 2016


Sent from my iPhone

> On 26 Oct 2016, at 06:56, Charlotte Tortorella via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Hi Chris,
> 
> I see, well with that in mind the proposal does set out how ?: is harmful to comprehension of code for new programmers and I hope the pros and cons of keeping it are thoroughly vetted. 
> 

They will be throughly vetted as any request is, but 1) I think the operator in question is easier to reason about that the alternative provided 2) this operator is not even in the league of the elements of the language which are important but may let you puzzled at first (good luck with explaining Swift unique take on protocol extension default methods to name one) and 3) I do not share a latent distaste for what C languages do and feel a need to distance ourselves from it (I would have kept the C style for loop, so I may not be the best one to ask about it ;)... or seen as things brewing when people argue about who is holier... I mean Swiftier and resulting Orthodoxy wars :P).

> Regards,
> Charlotte
> 
>> On 26 Oct. 2016, at 16:52, Chris Lattner <clattner at apple.com> wrote:
>> 
>> 
>>>> On Oct 25, 2016, at 10:30 PM, Charlotte Angela Tortorella via swift-evolution <swift-evolution at swift.org> wrote:
>>>> 
>>>>  Not a replacement for the Swift 4 source stability goal.
>>> 
>>> Swift 4 doesn't actually have a source stability goal. It has an ABI stability goal. These are two very different things. ABI is the calling conventions of the language.
>> 
>> Hi Charlotte,
>> 
>> Swift 4 has a strong source level compatibility goal.  This is explained in the main swift-evolution page and also in the proposal template:
>> https://github.com/apple/swift-evolution/blob/master/0000-template.md
>> 
>> "Relative to the Swift 3 evolution process, the source compatibility requirements for Swift 4 are much more stringent: we should only break source compatibility if the Swift 3 constructs were actively harmful in some way, the volume of affected Swift 3 code is relatively small, and we can provide source compatibility (in Swift 3 compatibility mode) and migration.”
>> 
>> I agree with you that a migrator could handle this change, but such a significant source breaking change still needs major justification for doing so.  Further in the Swift 3 timeframe, this very topic was hotly debated by the folks who wanted to turn the if statement into an expression (eliminating the need for the ?: operator).
>> 
>> -Chris
> _______________________________________________
> 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/32c621ac/attachment.html>


More information about the swift-evolution mailing list