On non-enum values, yes I could support this. However I do not see this as a 
big enough issue.
On enum values? no way….

Btw this would get rid of:

        let bytesSend = send(…) // returns an Int
                
        switch bytesSend {
        case Int.min ... -1: {…}
        case 0: {…}
        case 1 ... Int.max: {…}         
        default: break // <<<<<< Imposible
        }




> On 03 Oct 2016, at 12:14, Adrian Zubarev via swift-evolution 
> <swift-evolution@swift.org> wrote:
> 
> I know that there is this note in Commonly Rejected Changes:
> 
> Remove support for default: in switch and just use case _:: default is widely 
> used, case _ is too magical, and default is widely precedented in many C 
> family languages.
> I really like to use the switch instead of if case for pattern matching, just 
> because it’s neat block design. I do not want to remove default from switches 
> because it’s a must have and powerful feature.
> 
> I’d like to know why switches must be exhaustive. 
> 
> switch someValue {
>      
> case …:
>     // Do something
>      
> case …:
>     // Do something else
> 
> default:  
>     () // useless nop; do nothing when no pattern matched
> }
> 
> // VS:
> 
> if case … {
>      
> } else if case … {
>      
> } else if case … {
>      
> } // No need for `else`
> 
> Can’t we make default optional, or at least on non-enum values?
> 
> 
> 
> 
> -- 
> Adrian Zubarev
> Sent with Airmail
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution@swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

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

Reply via email to