[swift-evolution] Remove default case in switch-case

Rudolf Adamkovic salutis at me.com
Thu Dec 10 14:06:27 CST 2015


+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


More information about the swift-evolution mailing list