[swift-evolution] Make distinction between ?? -> T and ?? -> T?

David Waite david at alkaline-solutions.com
Mon Mar 7 15:38:45 CST 2016


I would assume ?! has the possibility of having an assert kill my application.

Is there a particular reason you are proposing this, such as a hard-to-diagnose bug?

-DW

> On Mar 7, 2016, at 2:29 PM, Sébastien Blondiau via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Currently, there is only one nil coalescing operator, which may return an optional value or not, depending on the second parameter. This variability can leads to unclear line of code:
> 
> var isItOptionalOrNot = value ?? otherValue
> 
> I think there should be two distinct operators:
> 
> var certainlyOptional = value ?? otherValue
> var certainlyNotOptional = value ?! notOptionalValue
> 
> In my point of view, this differentiation brings more clarity about wether the result is an optional or not.
> 
> What's your opinion?
> 
> --
> Sébastien Blondiau
> _______________________________________________
> 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/20160307/1e1842ca/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160307/1e1842ca/attachment.sig>


More information about the swift-evolution mailing list