[swift-evolution] [Pitch] Introducing the "Unwrap or Die" operator to the standard library
rltbennett at icloud.com
Wed Jun 28 10:49:27 CDT 2017
Instead of adding “@autoclosure ()->Never” to ??, why not make that the role of !! ? This would both make it clear that the unwrap is unsafe, like !, but also provide flexibility in how to report the error. E.G., optional !! fatalError(“oops”)
> On Jun 28, 2017, at 11:41 AM, Ben Cohen via swift-evolution <swift-evolution at swift.org> wrote:
>> On Jun 28, 2017, at 8:27 AM, David Hart via swift-evolution <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 ??
> 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.
> swift-evolution mailing list
> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution