[swift-evolution] ternary operator ?: suggestion

Charles Constant charles at charlesism.com
Thu Jan 7 05:23:43 CST 2016

My previous message was probably rash. I should have thought it over
instead of writing a knee-jerk response.

I'm not sure now that it's the syntax that is the issue in that example.
After I sent that message I started thinking about what I would do in real
life if I had to write that code, and there's plenty of ways one could
simplify it. For example, one could write a couple closures to handle the
different types of calculations that are done with the result, etc.

My gripes with the code are probably more to do with the explicit casting,
and - as you point out, Craig - the "let" for the argument of that enum
case. The casting could be worked around, easily. And most enums don't even
have any arguments...

Just ignore my last message. I think I was off base.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160107/6822f2e3/attachment.html>

More information about the swift-evolution mailing list