[swift-evolution] [Pitch] Introducing `Unwrappable` protocol
David Hart
david at hartbit.com
Wed Mar 8 00:25:22 CST 2017
> On 8 Mar 2017, at 03:27, Greg Parker via swift-evolution <swift-evolution at swift.org> wrote:
>
>
>> On Mar 7, 2017, at 3:49 PM, Jaden Geller via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>
>> It’s worth mentioning that the normal let binding can be used for pattern matching:
>> let (a, b, c) = foo()
>>
>> This nicely parallels the existing case syntax:
>> if case let .blah(a, b, c) = bar() { … }
>> It would feel inconsistent if the order switched when in a conditional binding.
>>
>> I would prefer that `case` was removed to best mirror the normal syntax, requiring `?` or `.some` to be used for optionals
>> if let .blah(a, b, c) = bar() { … }
>> if let unwrapped? = wrapped { … }
>> if let .some(unwrapped) = wrapped { … }
>> but I realize this is source-breaking, so I’m happy with the existing syntax.
>
> We tried `if let unwrapped? = wrapped` some time ago. It was unbelievably unpopular. We changed it back.
Who was it unpopular with? We’re talking about people inside Apple before Swift was released, right?
> --
> Greg Parker gparker at apple.com <mailto:gparker at apple.com> Runtime Wrangler
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170308/fdd03480/attachment-0001.html>
More information about the swift-evolution
mailing list