[swift-evolution] ternary operator ?: suggestion
felixcca at yahoo.ca
Tue Dec 22 07:59:06 CST 2015
In my opinion, the operator has a future. Swift is merely moving away from C-style constructs that promote mutable state. This kind of inline switch expression actually reminds me of pattern matching constructs in functional languages, and it may pick up more steam if the proposal for single-expression functions from the functional folks goes in.
I personally like the hybrid approach.
> Le 22 déc. 2015 à 04:07:34, Tino Heth via swift-evolution <swift-evolution at swift.org> a écrit :
> Hi there,
> I don't think the operator has a future in Swift:
> Considering that the C-style for-loop and ++/— are doomed, "?:" would look like a living fossil in the language.
> "??" can handle one use case really well, and if/switch aren't that bad in the other cases.
> I'm quite sure those arguments already came up in the thread, so here is my conclusion:
> I don't vote for ?: to be removed, but I wouldn't like to see a replacement that has more complexity.
> Best regards,
> swift-evolution mailing list
> swift-evolution at swift.org
More information about the swift-evolution