[swift-evolution] Remove default case in switch-case
Jeremy Pereira
jeremy.j.pereira at googlemail.com
Fri Dec 11 06:53:39 CST 2015
-1 from me.
- The meaning of “default” is more understandable and readable
- You can already use "case _" if you really want
- pretty much the entire existing Swift codebase would need to be changed if default was removed (and the existing code base will be much bigger by the time Swift 3 comes in).
I know backward compatibility isn’t considered to be a bar to accepting changes to Swift, but this does not mean it should be simply dismissed.
> On 10 Dec 2015, at 20:06, Rudolf Adamkovic via swift-evolution <swift-evolution at swift.org> wrote:
>
> +1 for using "case _" instead of "default". It communicates programmer's intent clear and loud. Also it didn't occur to me to use it. :)
>
> R+
>
> Sent from my iPhone
>
>> On 10 Dec 2015, at 03:51, Casey Cady via swift-evolution <swift-evolution at swift.org> wrote:
>>
>> FWIW, I think "default" is nicely expressive, and the _ construct always weirds me out just a little bit because while I understand it, it's not even a little bit intuitive to someone first learning a language.
>>
>> As an aside, I'd think that this list, and the discussion and transparency that it provides is awesome. Insanely great, even.
>>
>> Thanks!
>> Casey
>>
>> On Dec 9, 2015, at 6:37 PM, Matthew Johnson via swift-evolution <swift-evolution at swift.org> wrote:
>>
>>>> 1) We have had default and “case _” ever since Swift has been public. If you look at bodies of existing swift code, they almost unanimously use “default” instead of “case _”. This argues that default is more familiar and more widely used. It isn’t some legacy barnacle on the side that people generally ignore.
>>>
>>> I don’t have a strong feeling on this one way or the other, but I think it’s probably safe to say that the reason default is more familiar and widely used is because pretty much all the documentation I have seen does it that way, not because people like it better or because it is necessarily easy to understand. If the documentation was written using "case _" I think we would see that be the familiar and widely used variation.
>>>
>>> _______________________________________________
>>> swift-evolution mailing list
>>> swift-evolution at swift.org
>>> https://lists.swift.org/mailman/listinfo/swift-evolution
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
More information about the swift-evolution
mailing list