[swift-evolution] ternary operator ?: suggestion

Rainer Brockerhoff rainer at brockerhoff.net
Tue Jan 5 11:47:23 CST 2016

On 4/1/16 20:59 , swift-evolution-request at swift.org wrote:
> Date: Mon, 4 Jan 2016 17:03:54 -0600
> From: Matthew Johnson <matthew at anandabits.com>
> To: Paul Ossenbruggen <possen at gmail.com>
> Message-ID: <FE211ADC-F2A9-4485-B869-93BC8378ECD9 at anandabits.com>
>> > On Jan 4, 2016, at 2:37 PM, Paul Ossenbruggen via swift-evolution <swift-evolution at swift.org> wrote:
>> > 
>> > Good feedback, I am all for making it feel more like swift. Any ideas would be welcome. I will also try to come up with some myself. 
> My suggestion is to leave ternary alone and try to come up with a ternary-like switch expression that is workable.  I think that is likely the best change possible at this point.

I've reread my existing code. Ternary is very convenient but I'd vote
for either leaving it alone completely or find a Swift-y alternative
that enforces ( )s around the options.

That said, I couldn't really find any place where a "ternary-like switch
expression" would help much.

Rainer Brockerhoff  <rainer at brockerhoff.net>
Belo Horizonte, Brazil
"In the affairs of others even fools are wise
In their own business even sages err."

More information about the swift-evolution mailing list