[swift-evolution] Nil-rejection operator
Rob Mayoff
mayoff at dqd.com
Thu Feb 9 16:35:20 CST 2017
On Thu, Feb 9, 2017 at 2:25 PM, Haravikk via swift-evolution <
swift-evolution at swift.org> wrote:
> I wonder if an alternative to the original proposal might be to allow
> throw on the right hand side? So you could do:
>
> let y = x ?? throw myError
>
>
You can do this today:
extension Error {
func throwMe<R>() throws -> R { throw self }
}
let y = try x ?? MyError().throwMe()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170209/62891fda/attachment.html>
More information about the swift-evolution
mailing list