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

Xiaodi Wu xiaodi.wu at gmail.com
Wed Jun 28 22:24:45 CDT 2017


On Wed, Jun 28, 2017 at 10:18 PM, Alan Westbrook <alan at rockwoodsoftware.com>
wrote:

>
> On Jun 28, 2017, at 8:02 PM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
>
> I reject both these notions. Having seen the examples given above, I'm now
> leaning towards the conclusion that there is nothing in the way of
> explanation in a string that can usefully elaborate upon the very
> unambiguous statement that is a force unwrap.
>
>
> That the functionality exists to provide messages with fatal errors is an
> indication that they do have some utility.
>

Not at all. A message is required for `fatalError` simply to explain _what_
the error is. By contrast, it has already been conceded that there is
absolutely no confusion as to _what_ the error is in the case of a failed
force-unwrap. Rather, as Ben Cohen argued above, the idea behind this
proposal is that it is useful to explain the "why"--on the premise that
there is some "why" which is not deducible from the "what." My argument is
that there is no suitable "why" which can be suitably expressed in a
sugared form of a fatalError string argument.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170628/35bfe2c8/attachment.html>


More information about the swift-evolution mailing list