[swift-evolution] [Pitch] Guard/Catch

Greg Parker gparker at apple.com
Mon Jul 10 21:14:16 CDT 2017


> On Jul 10, 2017, at 1:51 AM, David Hart via swift-evolution <swift-evolution at swift.org> wrote:
> 
> I know we can’t do much about it now, but if optional binding had used the same syntax as it does in pattern matching, we wouldn’t be having this discussion:
> 
> guard let x = try doSomething() catch {
>     // handle error
> }
> 
> guard let x? = doSomething() else {
>     // handle when nil
> }

We tried pattern-matching syntax in `if let` a while ago. It was unbelievably unpopular. We changed it back.


-- 
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/20170710/20823d99/attachment.html>


More information about the swift-evolution mailing list