[swift-evolution] throw expressions in ternary operators

David Hart david at hartbit.com
Mon May 2 08:02:38 CDT 2016


Correct, it is not ternary, just a slip of my mind :)

> let age = try dictionary["age"].flatMap { elem in
>     try elem as? Int ?? { throw Error() }()
> }

I didn’t know this workaround worked. Cool! Can somebody from the core team tell us if it not supporting throw directly is a bug or an intended feature?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160502/4788ee54/attachment.html>


More information about the swift-evolution mailing list