[swift-evolution] [Pitch] Use "where" in combination with "??" to provide Ternary-like functionality

Charles Constant charles at charlesism.com
Tue May 24 03:26:07 CDT 2016


It did occur to me to use "::" but it seemed a bit cruel to have the
equivalent of  "? :" be reversed. Ie: by using ":: ??" If the team had
chosen :: to be the Nil Coalescing Operator, rather than ?? it would be
more tempting.

I had some problems messing around with these symbols. I think it was that
"??" is 131 and something else (maybe "==") was 130. Also the compiler can
be grumpy about long chains of things. I assume that will get better. Maybe
it has already gotten better, I'm still not on the latest version.

Anyhow, I think I'm fine just using the existing ternary... now that Dany
has made me realize I've been avoiding, any inefficiently mentally parsing,
long ternary chains for no good reason for the past decade. I'm fine, aside
from feeling disoriented!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160524/fcf4becd/attachment.html>


More information about the swift-evolution mailing list