[swift-evolution] Modernize Switch/Case Statements?

Charles Constant charles at charlesism.com
Fri Jan 29 00:00:28 CST 2016


The more I think about the "switch" statement, the more I feel it ought to
rewritten from scratch to be based on operators, like the ternary. Whenever
I consider using a "switch" statement in my code, I feel a small twinge of
reluctance. For something as basic as choosing between more than two cases,
the syntax is too verbose for my liking.

Having said that, if we're not going to make the "switch" statement less
verbose (and let's face it, it's we're not) then we ought to at least take
advantage of its benefits. And one of those benefits is that almost all
programmers already know its syntax from other C-inspired languages. So I
don't think we should mess around with it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160128/694f157d/attachment.html>

More information about the swift-evolution mailing list