Re: [swift-evolution] throw expressions in ternary operators

2016-05-02 Thread Chris Lattner via swift-evolution
> On May 2, 2016, at 6:41 AM, Krzysztof Siejkowski via swift-evolution > wrote: > >> Correct, it is not ternary, just a slip of my mind :) > > I have a great amount of understanding for that, I find `nil coalescing > operator` name simply impossible to remember :)

Re: [swift-evolution] throw expressions in ternary operators

2016-05-02 Thread David Hart via swift-evolution
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

[swift-evolution] throw expressions in ternary operators

2016-05-02 Thread David Hart via swift-evolution
I remember discussing something like this in swift-evolution but can’t find it. I was wondering if it was worth a proposal or not. When constructing objects from dictionary of values, I often write the parsing of optional values as such: age = try dictionary["age"].flatMap { if let age