[Idea] Deprecate the 'default' keyword.


(Anton Zhilin) #1

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?


(Ross O'Brien) #2

I'm going to create a formal proposal for this.

···

On Sat, Feb 27, 2016 at 3:56 PM, Антон Жилин <swift-evolution@swift.org> wrote:

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?

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(Ross O'Brien) #3

Submitted: https://github.com/apple/swift-evolution/pull/176

···

On Sat, Feb 27, 2016 at 4:39 PM, Ross O'Brien <narrativium+swift@gmail.com> wrote:

I'm going to create a formal proposal for this.

On Sat, Feb 27, 2016 at 3:56 PM, Антон Жилин <swift-evolution@swift.org> > wrote:

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?

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution