[swift-evolution] [Idea] Deprecate the 'default' keyword.

Антон Жилин antonyzhilin at gmail.com
Sat Feb 27 09:56:25 CST 2016


I agree with replacing `default` with `else`.
First of all, `default` or `by default` is generally associated with some
initial value, before any customization. `default` in `switch` is just a
borrowing from C. A newbie programmer will better get used to `else` than
to `default`.
Secondly, `switch` in Swift is almost the same as a sequence of
`if-else-if` (not just a table, as in C). `else` in `switch` would create
an association with last `else` in that chain.
Thirdly, `else` lines up nicely with `case`. You need to try it to feel the
difference.
Go ahead and create a formal proposal for this, or shall I do this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160227/c60dd716/attachment.html>


More information about the swift-evolution mailing list