[swift-evolution] [Idea] Add forced conversion for Error catching pattern matching

Greg Parker gparker at apple.com
Mon Mar 21 06:22:55 CDT 2016


> On Mar 20, 2016, at 1:26 PM, Tyler Fleming Cloutier via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Also as a brief aside, it’s not super intuitive to me that the syntax for the catch pattern matching wildcard is 
> 
> catch _
> 
> whereas it is
> 
> default
>  
> for switches. I think I saw Chris mention somewhere that default was chosen because of it’s wide familiarity. Does anyone recall the reason?

Yes, both `switch` and `default` were chosen because that's what other C-style languages use.

Note that `case _` is the same as `default` in `switch`, so you can use `case _` and `catch _` if you don't care about C-style appearance. 

I don't think anyone has proposed allowing `default` in place of `catch _`. There was an earlier discussion of removing `default` from `switch` and requiring `case _` instead (thread "Remove default case in switch-case" on swift-evolution).


-- 
Greg Parker     gparker at apple.com <mailto:gparker at apple.com>     Runtime Wrangler


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160321/8438fb2d/attachment.html>


More information about the swift-evolution mailing list