4 ms·
Yeah, agreed that exceptions make the exceptional path more expensive. But I think the normal path is cheaper. I'm not sold on resumable exceptions. It makes m
by cousin_it 8y ago
Yeah, agreed that exceptions make the exceptional path more expensive. But I think the normal path is cheaper.
I'm not sold on resumable exceptions. It makes more sense to pass default values directly. Have you seen this bit in Stroustrup's book: http://www.cpptips.com/term_except http://www.cpptips.com/term_except
- KirinDave 8y agoActually, I'm not entirely right here. Joe Groff caught up with me on twitter and explained to me that because Swift requires you to check exceptions, it actually generates static logic at the call site. This means handlers have a cost on both sides of the "railway", but it means that exception handling has a fairly optimal codepath. It'll still be cheaper to do a simple pattern match into a struct for complex handlers, but for depth 1 they should essentially be identical. That's a very interesting tradeoff for the Swift compiler!