[swift-evolution] [Pitch] Introducing the "Unwrap or Die" operator to the standard library

David Hart david at hartbit.com
Wed Jun 28 16:30:23 CDT 2017

> On 28 Jun 2017, at 17:41, Ben Cohen <ben_cohen at apple.com> wrote:
>> On Jun 28, 2017, at 8:27 AM, David Hart via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> Count me in as a strong proponent of ?? () -> Never. We don't need to burden the language with an extra operator just for that.
> You could say the same about ??

I have more difficulties saying the same for ?? as it provides a lot of value: a RHS Optional override and potentially a RHS Never closure override which would allow us to customise what happens before trapping. On the other hand, the !! operator, while useful, only provides a trapping behaviour with no way tu customise it.

> The concern that an additional operator (and one that, IMO, fits well into existing patterns) is so burdensome seems way overweighted in this discussion IMO. 
> Adding the operator, and encouraging its use, will help foster better understanding of optionals and legitimate use of force-unwrapping in a way that I don’t think `?? fatalError` could.

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

More information about the swift-evolution mailing list